LED灯:如果不知道板载灯的GPIO脚,看这里
#define LED_PIN D4
void setup() {
//初始化串口
Serial.begin(9600);
// put your setup code here, to run once:
// 设置管脚为输出模式
pinMode(LED_PIN,OUTPUT);
// 初始化时设置为高电平熄灭LED
digitalWrite(LED_PIN, HIGH);
}
void loop() {
// put your main code here, to run repeatedly:
// 点亮LED
if(Serial.available())
{
char ch= Serial.read();
Serial.print(ch);
if(ch=='a'){
digitalWrite(LED_PIN, LOW);
}else if(ch=='b'){
// 熄灭LED
digitalWrite(LED_PIN, HIGH);
}else{
}
}
}
看门狗:
ESP8266的看门狗,默认就是开启的,ESP.wdtEnable(uint32_t time_ms),ESP.wdtDisable(), ES