Component I used
1. Arduino Uno Board
2. Led
3. Arduino Development IDE
Every Arduino program has 2 basic functions which forms the structure of the arduino
void setup() {
} //Invoked only once
void loop() {
} //Invoked multiple times.
This program is going to blink the LED .i.e. ON-OFF-ON-OFF-ON-OFF.
Though the Arduino board has a builtin resister and led into the board. For the purpose of this blog, I am going to use external LED
1. Connect the Anode (long leg) part of Led to pin 13 & connect cathode to ground as shown in the below image.
2) Upload the below program to arduino using development kit
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
You should now able to see the LED going on-off-on-off every 1 second.
Though this is not the best way to blink the LED. The current circuit is supplying 5v to LED which is too much. Ideally, you will connect the resister with 220ohms and do the blink.
No comments:
Post a Comment