Arduino Led Light

Introduction: Arduino Led Light

the lights goes fast, but it can turn on when you're sleeping.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Tools

led lights

lines

220or330 resistor

arduino

breadboard

Step 2: Put Them Together

Step 3: Code

int del = 100; //defining delay value (0.1 second)

void setup() { // put your setup code here, to run once: pinMode(2, OUTPUT); //defining pins (2-13) as Outputs pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); pinMode(13, OUTPUT); }

void loop() { // put your main code here, to run repeatedly: for (int i = 2; i <= 13; i++) { // For loop will count from 2 to 13 to turn ON and OFF every single pin digitalWrite(i, HIGH); // Turning ON 1st output (LED) delay(del); // LED is ON for 20ms before turning OFF digitalWrite(i, LOW); // Turning OFF 1st output (LED) delay(del); // Waiting 20ms before running the 2nd cycle of FOR loop } for (int i = 13; i >= 2; i--) { // For loop will count from 13 to 2 to turn ON and OFF every single pin digitalWrite(i, HIGH); // Turning ON 1st output (LED) delay(del); // LED is ON for 20ms before turning OFF digitalWrite(i, LOW); // Turning OFF 1st output (LED) delay(del); // Waiting 20ms before running the 2nd cycle of FOR loop } }

Step 4: Finish!!!

Be the First to Share

    Recommendations

    • Magnets Challenge

      Magnets Challenge
    • Snow Challenge

      Snow Challenge
    • Wearables Contest

      Wearables Contest

    Discussions