Blink LED
1. Objective
The objective is talk about, how to use digitalWrite in arduino to blink LED.
2. Requirement
- Arduino Uno x1
- USB Cable x1 (No need in simulation)
- Breadboard x1 (No need in simulation)
- LED x2
- Resistor (220Ohm or 330Ohm) x2
- Electronic Wire (No need in simulation)
3. Build Circuit
Build circuit like Figure 1.
Figure 1: Arduino Connection |
4. Coding
// Coding by Tann Thona
(21/09/2019
)
int LED = 13;
void setup() {
// put your setup code here, to run once:
pinMode(LED, OUTPUT);
pinMode(12, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED,HIGH); // OUTPUT Voltage 5V
digitalWrite(12,0);
delay(500);
digitalWrite(LED, LOW);
digitalWrite(12,1);
delay(500);
}
Click Here to Download Code and Proteus Simulation File
4. Result
According to code above, this two LEDs was switching blink in 0.5 second.Watch Video Explain in Khmer
YouTube: ICT4D-KH
Copyright By Tann Thona
No comments:
Post a Comment