Up from hello world, now we go little bit further to make the LED blinking.
Some material we need:
"high" means 5V supply and make the LED is ON and
"low" meand 0V supply and make the LED is OFF.
The LED will be ON and OFF repeatedly every 1 second that's because we put the code on the loop.
Some material we need:
- Arduino (I am using Arduino UNO)
- LED
- 330 Ohm resistor
- PC/laptop
- Breadboard
- 3 jumperwire
- Data cable from Arduino to PC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Blink | |
Turns on an LED on for one second, then off for one second, repeatedly. | |
This example code is in the public domain. | |
*/ | |
void setup() { | |
// initialize the digital pin as an output. | |
// Pin 13 has an LED connected on most Arduino boards: | |
pinMode(13, OUTPUT); | |
} | |
void loop() { | |
digitalWrite(13, HIGH); // set the LED on | |
delay(1000); // wait for a second | |
digitalWrite(13, LOW); // set the LED off | |
delay(1000); // wait for a second | |
} |
"high" means 5V supply and make the LED is ON and
"low" meand 0V supply and make the LED is OFF.
The LED will be ON and OFF repeatedly every 1 second that's because we put the code on the loop.
No comments:
Post a Comment