Exemplo n.º 1
0
        private void ClosePin()
        {
            var relayPin      = Convert.ToInt32(_configuration["RelayPin"]);
            var gpioContoller = new System.Device.Gpio.GpioController();

            gpioContoller.OpenPin(relayPin, System.Device.Gpio.PinMode.Output);
            gpioContoller.Write(relayPin, System.Device.Gpio.PinValue.Low);
        }
Exemplo n.º 2
0
        public static async Task <Star> Create(IPEndPoint endpoint)
        {
            var driver = new Iot.Device.Pigpio.Driver(endpoint);

            await driver.ConnectAsync();

            // Line above doesn't current wait for connection so
            // delay here to give the socket time to get connected
            await Task.Delay(TimeSpan.FromSeconds(2));

            var gpioController = new System.Device.Gpio.GpioController(System.Device.Gpio.PinNumberingScheme.Logical, driver);

            foreach (int pin in PinMapping)
            {
                gpioController.OpenPin(pin);
                gpioController.SetPinMode(pin, System.Device.Gpio.PinMode.Output);
            }

            return(new Star(driver, gpioController));
        }