BLINK WITH ARDUINO
Intro:
This is the basic example what we can do with an arduino.
Hardware Required
- Ardunio
- Resistor(220 ohm)
- LED(blue)
circuit:
we all know that LED has two pin .one pin somewhat larger then other pin here the smaller pin is Ground Pin (-) and the larger pin is (+)ve. for this circuit we have to connect the larger pin of LED to the 13 no. digital pin of arduino (uno).and connect negetive pin to the ground pin that is present just beside the 13 no. pin.
Code:
void setup() {
//put your setup code here, to run code:
pinMode (13,OUTPUT);
}
void loop() {
//put your main code here, to run repeatedly:
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
}
Here we get output in the from of light blink. and it shown in 13 no. pin so we write pinMode(13,OUTPUT). in void loop digitalWrite (13,HIGH) it simply means that LED on we can say HIGH=ON and similarly LOW=OFF .and delay shows that after ON it stay on for 1sec and afterthat it truns OFF again on after 1sec .
(NOTE: 1000ms=1sec)
Comments
Post a Comment