openhw:arduino:arduino_starter_kit_r4
This is an old revision of the document!
Άσκηση 1
Άσκηση 2
int switchState = 0 ;
void setup() {
// put your setup code here, to run once:
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(2,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
switchState = digitalRead(2);
if (switchState == LOW) {
digitalWrite(3,HIGH); // green LED
digitalWrite(4,LOW); // red LED
digitalWrite(5,LOW); // red LED
}
else {
digitalWrite(3,LOW); // green LED
digitalWrite(4,LOW); // red LED
digitalWrite(5,HIGH); // red LED
delay(250);
digitalWrite(4,HIGH); // red LED
digitalWrite(5,LOW); // red LED
delay(250);
}
}
openhw/arduino/arduino_starter_kit_r4.1773919526.txt.gz · Last modified: by alexandrospr





