Pages

Wednesday, May 30, 2018

Arduino LED lesson(Knight Rider)

Ignite few LEDs by using "for loops"

Required components:-
   1). Arduino uno(you can use any type)
2). 8×LEDs
3). 8× 220 ohms resistors
4). Few jumper wires
5). Breadboard



Step 01:- 
Connect your LEDs and resistors to the breadboard as in the picture given above.

Step 02:-
Connect the eight resistors which connected to the LEDs to GND pin in arduino board.

Step 03:-
Connect the (+) pins of LEDs to 6,7,8,9,10,11,12,13 pins in arduino board.

Step 04:-
Now uploas the code given below.


Code:

void setup(){

for(int i=6; i<=13; i++){
pinMode(i, OUTPUT);
}
}

void loop(){

for(int j=6; j<=13; j++){
digitalWrite(j, HIGH);
delay(100);
digitalWrite(j, LOW);
}

for(int j=12; j>6; j--){
digitalWrite(j, HIGH);
delay(100);
digitalWrite(j, LOW);
}
}











Tuesday, May 29, 2018

Blink a led by using arduino uno


Step 01:-
    connect your led (-) pin to GND pin.
connect led(+) pin to 13th pin.

Step 02:-
Upload the code given below.


code:

void setup(){
    pinMode(13, OUTPUT);
}

void loop(){
    digitalWrite(13, HIGH);
delay(200);
digitalWrite(13, LOW);
delay(200);
}



~UK~
2018.05.29