Exemplo n.º 1
0
        public async static void ConfigureGpio()
        {
            try
            {
                await Bus1.Connect();
            }
            catch (Exception)
            {
                Debug.WriteLine("No se ha podido conectar con el dispositivo I2C 0x20.");
            }

            Bus1.SetPortDirection(0, 0x00);
            Bus1.SetPortDirection(1, 0x00);
            Bus1.WritePort(0, 0x00);
            Bus1.WritePort(1, 0x00);
            Reset.SetDriveMode(GpioPinDriveMode.Output);
            Reset.Write(GpioPinValue.High);
            Buzzer.SetDriveMode(GpioPinDriveMode.Output);
            Buzzer.Write(GpioPinValue.Low);
            EntranceRSw1.SetDriveMode(GpioPinDriveMode.Input);
            TerraceRSw2.SetDriveMode(GpioPinDriveMode.Input);
            GarageRSw3.SetDriveMode(GpioPinDriveMode.Input);
            BedroomCurtain.SetDriveMode(GpioPinDriveMode.Input);
            LivingRoomCurtain.SetDriveMode(GpioPinDriveMode.Input);
            BathroomCurtain.SetDriveMode(GpioPinDriveMode.Input);
            GarageDoor.SetDriveMode(GpioPinDriveMode.Input);
            LightSensor.SetDriveMode(GpioPinDriveMode.Input);
        }