//Method to write 0x03 to the humidity control register private async Task WriteControlRegisterHumidity() { i2cBus.WriteBytes(BMP280_Address, new byte[] { (byte)eRegisters.BMP280_REGISTER_CONTROLHUMID, 0x03 }); await Task.Delay(1); return; }
public double GetTemperature() { byte[] bytes = new byte[] { 0xF4, 0x2E }; bus.WriteBytes(deviceID, bytes); System.Threading.Thread.Sleep(6); long ut = ReadUnsignedWord(0xF6, 0xF7); long x1 = (long)((ut - AC6) * AC5 / Math.Pow(2, 15)); long x2 = (long)(MC * Math.Pow(2, 11) / (x1 + MD)); long b5 = x1 + x2; long temp = (long)((b5 + 8) / Math.Pow(2, 4)); return(temp * 0.1); }
public void SetRegisterValues(Pin pin, ushort on, ushort off) { byte[] data = new byte[5]; data[0] = (byte)(Pca9685.Channel0OnLow + 4 * (byte)pin); data[1] = (byte)on; data[2] = (byte)(on >> 8); data[3] = (byte)(off); data[4] = (byte)(off >> 8); i2c.WriteBytes(data); }