Example #1
0
        public HumiditySensor()
        {
            _peripheralManagerService = new PeripheralManagerService();
            _rawDevice = _peripheralManagerService.OpenI2cDevice(_peripheralManagerService.I2cBusList.First(), ADDRESS);

            InitHandler();
        }
        public LedMatrix(string bus)
        {
            var pioService = new PeripheralManagerService();

            _device
                =
                    pioService.OpenI2cDevice
                        (bus, SenseHat.I2CAddress);
        }
 void WriteToMatrix(byte[] bytes, int retry = 0)
 {
     try
     {
         using (var rawDevice = _peripheralManagerService.OpenI2cDevice(_peripheralManagerService.I2cBusList.First(), ADDRESS))
         {
             rawDevice.Write(bytes, bytes.Length);
             rawDevice.Close();
         }
     }
     catch (IOException)
     {
         if (retry < MAX_RETRIES)
         {
             Thread.Sleep(8);
             WriteToMatrix(bytes, retry++);
         }
         else
         {
             throw;
         }
     }
 }
Example #4
0
 public PressureSensor()
 {
     _peripheralManagerService = new PeripheralManagerService();
     _rawDevice = _peripheralManagerService.OpenI2cDevice(_peripheralManagerService.I2cBusList.First(), ADDRESS0);
 }