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 }

Step 1: Fast & Easy Way to Learn How to Use Arduino Microcontroller

Share

    Recommendations

    • Classroom Science Contest

      Classroom Science Contest
    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest
    • Party Challenge

      Party Challenge

    Discussions