Program
Switching on and off of 3 LEDs
int ledPin1 = 6; // Defi nes the LEDs outputs
int ledPin2 = 7;
int ledPin3 = 8;
void setup() { // set the outputs
pinMode(ledPin1, OUTPUT); // declare LEDs as outputs
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
digitalWrite(ledPin1, LOW); // Turn off the LEDs
digitalWrite (ledPin2, LOW);
digitalWrite (ledPin3, LOW);
}
void loop() { //work loop
digitalWrite(ledPin1, HIGH); // turn off and on the LEDs lights every 200 ms
delay (200);
digitalWrite (ledPin1, LOW);
digitalWrite (ledPin2, HIGH);
delay (200);
digitalWrite (ledPin2, LOW);
digitalWrite (ledPin3, HIGH);
delay (200);
digitalWrite (ledPin3, LOW);
}
12
12