int led2 = 3;
int led3 = 4;
int sw = 8;
void setup() {
// put your setup code here, to run once:
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(sw, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int swInput = digitalRead(sw);
if (swInput == ' '){
digitalWrite (led1,HIGH);
digitalWrite (led2,LOW);
digitalWrite (led3,LOW);
} else {
(swInput == ' ');
digitalWrite (led1,LOW);
digitalWrite (led2,LOW);
digitalWrite (led3,LOW);
}
}
No comments:
Post a Comment