Preloading
❔ Segmentation fault when running app on raspberry pi
I am trying to compile a .net app for a raspberry pi, and making a very simple gpio app, but i'm getting a Segmentation fault when i run the app.
Code:
using System;
using Riptide;
using System.Device.Gpio;
using System.Threading;
namespace LazerTagModule // Note: actual namespace depends on the project name.
{
internal class Program
{
static int lazerOut = 0;
static int irOut = 1;
// Ir Inputs
static int irInLeft = 2;
static int irInRight = 3;
static int irInFront = 4;
static int irInBack = 5;
static int irInPhazer = 6;
// Body LEDs
static int ledLeft = 7;
static int ledRight = 8;
static int ledFront = 9;
static int ledBack = 10;
// Phazer LEDs
static int ledPhazer1 = 11;
static int ledPhazer2 = 12;
static int ledPhazer3 = 13;
static int ledPhazer4 = 14;
// Speaker
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
using var controller = new GpioController();
controller.OpenPin(ledLeft, PinMode.Output);
bool ledOn = true;
while (true)
{
controller.Write(ledLeft, ((ledOn) ? PinValue.High : PinValue.Low));
Thread.Sleep(1000);
ledOn = !ledOn;
}
}
}
}
using System;
using Riptide;
using System.Device.Gpio;
using System.Threading;
namespace LazerTagModule // Note: actual namespace depends on the project name.
{
internal class Program
{
static int lazerOut = 0;
static int irOut = 1;
// Ir Inputs
static int irInLeft = 2;
static int irInRight = 3;
static int irInFront = 4;
static int irInBack = 5;
static int irInPhazer = 6;
// Body LEDs
static int ledLeft = 7;
static int ledRight = 8;
static int ledFront = 9;
static int ledBack = 10;
// Phazer LEDs
static int ledPhazer1 = 11;
static int ledPhazer2 = 12;
static int ledPhazer3 = 13;
static int ledPhazer4 = 14;
// Speaker
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
using var controller = new GpioController();
controller.OpenPin(ledLeft, PinMode.Output);
bool ledOn = true;
while (true)
{
controller.Write(ledLeft, ((ledOn) ? PinValue.High : PinValue.Low));
Thread.Sleep(1000);
ledOn = !ledOn;
}
}
}
}
2 replies