Blinking LED:
HI, Axtyax here!Now that you have gotten your arduino and IDE, you are ready to start exploring the world of arduino!
Things You Will Need
- Solderless Breadboard (if you dont know what this is, look it up)
- Wires
- An arduino
- The arduino cable to connect it to your computer
- A computer with the arduino IDE
- Im not completely sure, but i think you will need an 820ohm 1/8w resistor
- (if you know of better specs for the resistor, just comment please)
- And finally, an LED.
This is a visual representation of how to wire up your circuit that i made in an application called fritzing, which you should definitely download from this link to create schematics for any of your arduino projects.
Ok so now that you have wired up the arduino and
resistor and LED, lets get started on the code!
This is the code:
-----------------------------------------------------------------------------------------
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
-----------------------------------------------------------------------------------------------------------
So save and upload it to the arduino, and the LED should be blinking!!!
If it doesn't work, try with another LED, it may have just burnt out.
Thanks for reading!
Don't forget to tell your friends and such about this blog, we need more followers!
Comments
Post a Comment