ardrino#串口控制led
作者:互联网
void setup() { pinMode(D6, OUTPUT); digitalWrite(D6,HIGH); Serial.begin(9600); } void loop() { String state = Serial.readString(); if (state == "off") { digitalWrite(D6, HIGH); Serial.println("we turn off the led."); } else if (state == "on") { digitalWrite(D6, LOW); Serial.println("we turn on the led."); } delay(1000); }
标签:led,digitalWrite,void,state,ardrino,串口,D6,Serial 来源: https://www.cnblogs.com/luohaonan/p/12166230.html