![]()
All we need to do is upload the code from this page and watch the LED react to our commands. This is a good time to take a look at the code and comments to start to get a feel for how it works. Change the two “delay” values and upload it again to see how the flashing pattern changes.
Step 1: Connect your UNO to your computer with the USB cable. Congratulations, you have just created and run your first UNO project.
Code:
//------------- Code Starts Here ----------------------------
//-----------------------------------------
//Published by IntroductionToArduino.com
//Created by Paul Illsley (www.paulillsley.com)
//Please use and share so others can enjoy
//-----------------------------------------
void setup() {
// setting pin 13 (the LED) as an output (this is the pin for the UNO's on-board LED).
pinMode(13,OUTPUT);
}
void loop() {
// setting the voltage of pin 13 to HIGH (5 volts), the LED turns on
digitalWrite(13,HIGH);
// delay 1000 milliseconds (1 second)
delay(1000);
// setting the voltage of pin 13 to LOW (0 volts), the LED turns off
digitalWrite(13,LOW);
// delay 1000 milliseconds (1 second)
delay(1000);
}
//------------- Code Stops Here ----------------------------
Return to www.introductiontoarduino.com
|