|
请问有没有大佬使用过bh1750连接机智云app,我单独用串口看光强可以检测到变化,但是上传到机智云app数据点显示的时候,就只能看到第一下测的初始值,也就是它数值不会变化,可以解答一下吗
byte hi**yte = 0;
byte lowByte = 0;
unsigned int sensorOut = 0;
uint32_t Light_Value = 0;
Wire.beginTransmission(ADDRESS_BH1750FVI); //"notify" the matching device
Wire.write(ONE_TIME_H_RESOLUTION_MODE); //set operation mode
Wire.endTransmission();
Wire.requestFrom(ADDRESS_BH1750FVI, 2);
hi**yte = Wire.read(); // get the high byte
lowByte = Wire.read(); // get the low byte
sensorOut = (hi**yte<<8)|lowByte;
Light_Value = sensorOut/1.2;
myGizwits.write(VALUE_Light_intensity,Light_Value);
这是bh1750的机智云代码
谢谢各位!!!
|
|