How to Blink 3 LEDs Using Arduino
by ALP Electronic Innovation in Circuits > Arduino
18 Views, 0 Favorites, 0 Comments
How to Blink 3 LEDs Using Arduino
/*
Modifying the Blink sketch Attached 3 LEDs with 220 Ohms resistor */ int ledGreen = 12; // Green LED int ledYellow = 11; // Blue LED int ledRed = 10 ; // Red LED
// the setup routine runs once when you press reset: void setup() { // initialize the digital pins (12, 11, 10) as an output. pinMode(ledGreen, OUTPUT); pinMode(ledYellow, OUTPUT); pinMode(ledRed, OUTPUT); }
// the loop routine runs over and over again forever: void loop() { digitalWrite(ledGreen, HIGH); // turn the LED on delay(1000); // wait for a second digitalWrite(ledGreen, LOW); // turn the LED off delay(1000); // wait for a second digitalWrite(ledYellow, HIGH); // turn the LED on delay(1000); // wait for a second digitalWrite(ledYellow, LOW); // turn the LED off delay(1000); // wait for a second digitalWrite(ledRed, HIGH); // turn the LED on delay(1000); // wait for a second digitalWrite(ledRed, LOW); // turn the LED off delay(1000); // wait for a second }