Introduction: Simple Arduino LED Flag Flasher
This is my first Arduino Project)
i will show simple steps how to make led flag flesher!!
Step 1: Materials
You will need:
Arduino
Breadboard
3x 240ohm resistors
1x Clear Red l.e.d
1x Clear Blue l.e.d
1x Clear Yellow l.e.d
Some Jumper Cables
Step 2: Place Components on Breadboard
Step 3: The Code
The Code is very Simple:
// Project 1 - Flag Flasher
int ledDelay = 50; // delay by 50ms
int spaceDelay=300; //delay by 300ms
int bluePin = 11;
int yellowPin=7;
int redPin = 9;
void setup()
{
pinMode(redPin, OUTPUT);
pinMode(bluePin, OUTPUT);
pinMode(yellowPin,OUTPUT);
}
void loop() {
digitalWrite(bluePin, HIGH); //turn the light on
delay(ledDelay); // wait 50 ms
digitalWrite(bluePin, LOW); //turn the light off
delay(ledDelay); // wait 50 ms
digitalWrite(bluePin, HIGH);
delay(ledDelay); // wait 50 ms
digitalWrite(bluePin, LOW);
delay(ledDelay); // wait 50 ms
delay(spaceDelay); // delay midpoint by 300ms
digitalWrite(yellowPin, HIGH);
delay(ledDelay); // wait 50 ms
digitalWrite(yellowPin, LOW);
delay(ledDelay); // wait 50 ms
digitalWrite(yellowPin, HIGH);
delay(ledDelay); // wait 50 ms
digitalWrite(yellowPin, LOW);
delay(ledDelay); // wait 50 ms
delay(spaceDelay);
digitalWrite(redPin, HIGH);
delay(ledDelay); // wait 50 ms
digitalWrite(redPin, LOW);
delay(ledDelay); // wait 50 ms
digitalWrite(redPin, HIGH);
delay(ledDelay); // wait 50 ms
digitalWrite(redPin, LOW);
delay(ledDelay); // wait 50 ms
delay(spaceDelay);
}
Step 4: Edit and Make Your Code...
you may edit code, add more led's and make the lights flash faster!!
good luck and greetings from MOLDOVA!! ;)