esp32按键控制led灯,为什么按键按下后没反应,是线接错了嘛,还是程序写错啦,初学者求指点
这是代码
#include <Arduino.h>
#define PIN_KEY 5
#define PIN_LED 18
int led_status = 0;
void setup(){
Serial.begin(115200);
pinMode(PIN_KEY,INPUT_PULLUP);
pinMode(PIN_LED,OUTPUT);
led_status = HIGH;
}
void loop(){
if(digitalRead(PIN_KEY == LOW)){
delay(10);
if(digitalRead(PIN_KEY == LOW)){
led_status = !led_status;
digitalWrite(PIN_LED,led_status);
}
}
}
这是接线
物联网设备的系统启动成功并连接到物联网平台之后,物联网平台上对应的设备状态会从”未激活状态“变为”上线“,在物模型数据标签页上会显示设备上报到物联网平台的属性值。
此时如果设备端测到异常体温,物联网平台的物模型数据会更新为设备上报的最新的属性值。