Programm-Beispiel:
ampel.ino
const int rot = 10;
const int gelb = 9;
const int gruen = 8;
void setup() {
pinMode(rot, OUTPUT);
pinMode(gelb, OUTPUT);
pinMode(gruen, OUTPUT);
}
void loop() {
digitalWrite(rot, HIGH);
delay(2000);
digitalWrite(gelb, HIGH);
delay(1500);
digitalWrite(gruen, HIGH);
digitalWrite(rot, LOW);
digitalWrite(gelb, LOW);
delay(2000);
digitalWrite(gruen, LOW);
digitalWrite(gelb, HIGH);
delay(2000);
digitalWrite(gelb, LOW);
}