类别:嵌入式开发 > 电子元件
发布时间: 2024年11月1日 星期五 20:09:59
电子元器件 涉及内容:二极管,三极管,电容,电阻,电感,整流器,整流桥,适配器,电工工具,电子DIY套件,电烙铁,松香,焊锡丝,变压器,漆包线,电线,天线,单片机,MCU,芯片,集成电路,集成块,DC插头,面包板,杜邦线,插座,音频线,音频座,耳机插孔,排针,排针母座,紧锁座,烧录器,下载线, arduino套件,arduino主板(uno、Esp8266),microBIT,STM32,ARM微处理器与开发IDE环境。
int photocellPin = 0; // the cell and 10K pulldown are connected to a0
int photocellReading; // the analog reading from the analog resistor divider
void setup(void) {
// We'll send debugging information via the Serial monitor
Serial.begin(9600);
}
void loop(void) {
photocellReading = analogRead(photocellPin);
Serial.print("Analog reading = ");
Serial.print(photocellReading); // the raw analog reading
// We'll have a few threshholds, qualitatively determined
if (photocellReading < 10) {
Serial.println(" - Dark");
} else if (photocellReading < 200) {
Serial.println(" - Dim");
} else if (photocellReading < 500) {
Serial.println(" - Light");
} else if (photocellReading < 800) {
Serial.println(" - Bright");
} else {
Serial.println(" - Very bright");
}
delay(1000);
}
视频章节数: 2 | 总播放时间:0:00:00 | 访问次数: | 产品使用状态:启动播放中
视频总数: 15 | 产品类别:嵌入式开发 > 电子元件

