Ejemplo n.º 1
0
        public static async Task <ADS1015> Open()
        {
            var i2cSettings = new I2cConnectionSettings(I2C_ADDRESS);
            var controller  = await I2cController.GetDefaultAsync();

            var device = controller.GetDevice(i2cSettings);
            var result = new ADS1015(device);


            return(result);
        }
Ejemplo n.º 2
0
        public static async void Init()
        {
            try
            {
                _power = new Led(17);
                _comms = new Led(16);
                _warn  = new Led(15);

                Relay1 = new Relay(13, 6, 7);
                Relay2 = new Relay(19, 8, 9);
                Relay3 = new Relay(16, 10, 11);

                Output1 = new Output(5, 3);
                Output2 = new Output(12, 4);
                Output3 = new Output(6, 5);


                Input1 = new Input(26, 14, true, Controllers.GPIOController);
                Input2 = new Input(20, 13, true, Controllers.GPIOController);
                Input3 = new Input(21, 12, true, Controllers.GPIOController);

                _a2dController[0] = new AnalogInput(0, 25.85, new Led(0));;
                _a2dController[1] = new AnalogInput(1, 25.85, new Led(1));;
                _a2dController[2] = new AnalogInput(2, 25.85, new Led(2));;
                _a2dController[3] = new AnalogInput(3, 3.3, null);


                // Turn the power light on
                _ledDriver = await SN3218LEDDriver.Open();

                _ledDriver.Enable();
                _ledDriver.EnableLeds();

                _a2dController = await ADS1015.Open();


                _refreshTimer = ThreadPoolTimer.CreatePeriodicTimer(x => Tick(), TimeSpan.FromMilliseconds(20));
            }
            catch (Exception ex)
            {
            }
        }