楼主: Jane
|
[入门教程] Arduino教程02 做一个S.O.S求救信号灯「DFR0100 」 |
int ledRed = 2; int ledYellow = 3; int ledGreen = 4; void setup() { pinMode(ledRed,OUTPUT); pinMode(ledYellow,OUTPUT); pinMode(ledGreen,OUTPUT); } void loop() { // put your main code here, to run repeatedly: digitalWrite(ledRed,HIGH); delay(5000); digitalWrite(ledYellow,HIGH); delay(2000); digitalWrite(ledRed,LOW); digitalWrite(ledYellow,LOW); digitalWrite(ledGreen,HIGH); delay(5000); digitalWrite(ledGreen,LOW); digitalWrite(ledYellow,HIGH); delay(2000); digitalWrite(ledYellow,LOW); } |
红绿灯。。。
|
本帖最后由 Cloud-Tifa 于 2023-4-30 18:33 编辑 int red = 7, yellow = 3, green = 4; void setup() { pinMode(red,OUTPUT); pinMode(yellow,OUTPUT); pinMode(green,OUTPUT); } void loop() { digitalWrite(red,HIGH); digitalWrite(yellow,LOW); digitalWrite(green,LOW); delay(5000); digitalWrite(red,HIGH); digitalWrite(yellow,HIGH); digitalWrite(green,LOW); delay(2000); digitalWrite(red,LOW); digitalWrite(yellow,LOW); digitalWrite(green,HIGH); delay(5000); digitalWrite(red,LOW); digitalWrite(yellow,HIGH); digitalWrite(green,LOW); delay(2000); } |
© 2013-2025 Comsenz Inc. Powered by Discuz! X3.4 Licensed