Wemos D1 继电器
int Relay = 2; void setup() { pinMode(Relay, OUTPUT); Serial.begin(115200); } void loop() { Serial.println("Plase input H or L:"); char cmd; while(Serial.available() > 0){ cmd = Serial.read(); if (cmd == 'H') { Serial.println("Relay is HIGH"); digitalWrite(Relay,HIGH); } else if(cmd == 'L'){ Serial.println("Relay is LOW"); digitalWrite(Relay,LOW); } } delay(5000); }
作者:儒良设计
-------------------------------------------
个性签名:独学而无友,则孤陋而寡闻。做一个灵魂有趣的人!
万水千山总是情,打赏一分行不行,所以如果你心情还比较高兴,也是可以扫码打赏博主,哈哈哈(っ•̀ω•́)っ✎⁾⁾!