public static void Main() { DigitalLed led = new DigitalLed(Pin.Pin0); IDigitalInterrupt startTests = Signals.DigitalInterrupt.Bind(Pin.Pin1, "Restart Testing", ResistorMode.PullUp, InterruptMode.InterruptEdgeLow, 50); var input = new GpioInput(startTests); LedTestHarness.RunTests(Assembly.GetExecutingAssembly(), led, input); }
public static void Main() { DigitalLed led = new DigitalLed((Pin)SecretLabsPinAssignment.ONBOARD_LED); IDigitalInterrupt startTests = Signals.DigitalInterrupt.Bind((Pin)SecretLabsPinAssignment.GPIO_PIN_D0, "Restart Testing", ResistorMode.PullUp, InterruptMode.InterruptEdgeLow, 50); var input = new GpioInput(startTests); LedTestHarness.RunTests(Assembly.GetExecutingAssembly(), led, input); }
public static void Main() { /* Pick a driver that matches your hardware setup */ IDriveTextDisplays driver = null; CharacterDisplay lcd = new CharacterDisplay(20, 4, driver) { IsCursorBlinking = false, IsCursorUnderlined = false }; /* Hook user input buttons */ IDigitalInterrupt startTests = Signals.DigitalInterrupt.Bind(Pin.Pin1, "Restart Testing", ResistorMode.PullUp, InterruptMode.InterruptEdgeLow, 50); var input = new GpioInput(startTests); /* Run the tests */ lcd.ClearScreen(); TextTestHarness.RunTests(Assembly.GetExecutingAssembly(), lcd, input); }
public void Post([FromBody] GpioInput input) { var gpioPin = Pi.Gpio.Pin00; // Colour switch (input.Colour) { //yellow = GPIO017 case "yellow": gpioPin = Pi.Gpio.Pin00; break; //blue = GPIO018 case "blue": gpioPin = Pi.Gpio.Pin01; break; } // Set PinMode gpioPin.PinMode = GpioPinDriveMode.Output; // Read the current state var isOn = gpioPin.Read(); // Command switch (input.Command) { case "on": if (!isOn) { gpioPin.Write(true); } break; case "off": if (isOn) { gpioPin.Write(false); } break; } }