Project Four: Pattern, Blink 4 leds using Arduino board

Project Four: Pattern,  Blink  4 leds using Arduino board

Project Four: Pattern,  Blink  4 leds using Arduino board will basically get you up and blink four leds using Arduino board in pattern. i.e Mpesa Display

Components

Quantity Module/component Description price Range
1 Arduino board (Uno)+Cable more 1200-2500/=
4 Resistor Any electronics supply store 10-20/=
4 LED From 1k Ω to 2KΩ 10-20/=
14 Connecting Wires (Jumpers) learn more 50/=
1 Breadboard learn more 150/=

Send us a request using the contact section if you don't have any.

 

 

Note: In this project, we are using 4  Resistors ( 1k resistor ), 4 Leds, Arduino pin 5, Pin 6, Pin 7, Pin 8 and Gnd pin to create a connection(Circuit)





A good example is the one in the picture below



1. Connect ground from the Arduino to the bottom row of the farthest right column breadboard this will be a shared line.

2. For LED1

a) Connect the resistor with one end with longer leg of led and the other end using wire on the arduino pin 6 (Arduino pin 6). b) Connect an LED cathode (shorter leg) to ground.

3. For LED2

a) Connect the resistor with one end with longer leg of led and the other end using wire on the arduino pin 7 (Arduino pin 7). b) Connect an LED cathode (shorter leg) to ground.

4. For LED3

a) Connect the resistor with one end with longer leg of led and the other end using wire on the arduino pin 8 (Arduino pin 8). b) Connect an LED cathode (shorter leg) to ground.

5. For LED4

a) Connect the resistor with one end with longer leg of led and the other end using wire on the arduino pin 5 (Arduino pin 5). b) Connect an LED cathode (shorter leg) to ground.

SKETCH

  
const int led1 =6; // one end led1 is connected to pin 7 
const int led2 =7; // one end led2 is connected to pin 7 
const int led3 =8; // one end led3 is connected to pin 7 
const int led4 =5; // one end led4 is connected to pin 7 
voidsetup()
{

pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
}

void loop ()    
{

      // turn on each of the LEDs in order

digitalWrite(led1, HIGH);
delay(100);
digitalWrite(led2, HIGH);
delay(100);
digitalWrite(led3, HIGH);
delay(100);
digitalWrite(led4, HIGH);
delay(100);

      //   turn off each of the LEDs in order

digitalWrite(led1, LOW);
delay(100);
digitalWrite(led2, LOW);
delay(100);
digitalWrite(led3, LOW);
delay(100);
digitalWrite(led4, LOW);
delay(100);

}

Comments

Popular posts from this blog

Arduino function libraries~Math Library Function

Arduino - Strings