这里用c# .net 6 树莓派 i2c通讯 读取温湿传感器 芯片sht30 实例
设备:
1、温湿度传感器sht30
2、树莓派
设备在某宝上可以选购得到
nuget下载引用:
Iot.Device.Sht3x;
System.Device.I2c;
复制代码 即可用:
using Iot.Device.Sht3x;
using System.Device.I2c;
public static void getTemperature()
{
I2cConnectionSettings set = new(1, (byte)OverWriteI2cAddress.AddrLow);
I2cDevice dev = I2cDevice.Create(set);
using Sht3x sht = new Sht3x(dev);
while (true)
{