照度计出现问题,串行监视器显示设备未配置

时间:2019-09-25 20:33:57

标签: arduino

我想用BH1750和arduino mega读取一定量的勒克斯,但是串行监视器不读取它,它只说未配置设备

这是我的代码

#include <Wire.h>
#include <BH1750.h>

BH1750 lightMeter;

void setup() {
  // put your setup code here, to run once:
Wire.begin();
Serial.begin(9600);
lightMeter.begin();
Serial.println("Sensing started!...");
delay(500);

}

void loop() {
  // put your main code here, to run repeatedly:
uint16_t intensity= lightMeter.readLightLevel();
Serial.print("Light intensity: ");
Serial.print(intensity);
Serial.println(" lx");
delay(500);
}

0 个答案:

没有答案