Arduino Beginner Tutorial: Led Blink
by TheMaker09 in Circuits > Arduino
301 Views, 0 Favorites, 0 Comments
Arduino Beginner Tutorial: Led Blink
You are going to create your first Arduino project. I will go in-depth as possible as to how to do it. You are going to create a light that turns off and on. I know it is boring but it will be good to learn.
Supplies
1x Arduino Uno (any Arduino will work but this one is the most common. Clones will also work.)
1x breadboard
2x male to male(the pointed sides) jumper wires
1x cord for Arduino
You will also need the Arduino IDE. You can get it here it is free. Software | Arduino (note I am using the 2.0 beta software you can use it too just when you click on that link scroll down to the beta version. I recommend using the newest official version because then you won't run into any bugs that might make a beginner frustrated.
Connect Components.
Plug in the led to the breadboard. Make sure they are on different strips. On the breadboard, you will find numbers. The holes that are in between the middle strip and the number are connected. Connect your two wires two the positive side and the negative side of the led. The positive side is the side with the longer terminal. Plug the POSITIVE side into Arduino pin 5 (any pin will work but for the total beginner's sake with no coding experience I highly recommend not trying to modify the code just for a pin. though after you understand the code it will be a good test to change the pin in the code.) plug the NEGATIVE side into one of the ground pins on the Arduino. Remember the wires can go into any hole on the same row as the led terminal that you are connecting it to.
Connect Arduino to Computer
open the Arduino IDE and plug in your Arduino. Then go into tools and click "board" then click Arduino Uno (or whatever board you are using.) Then click on "Port" and click on the port you are using (The correct one is usually the only one that appears.)
Upload Code
Now copy and paste this into your Arduino Ide after clearing everything that comes in automatically.
const int ledpin = 5; //This tells the arduino that this variable equals 5 which later in the sketch will tell the arduino that the light is on pin 5.
void setup() {
pinMode(ledpin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(ledpin, HIGH); //turns the light on
delay(1000); //takes a 1 second break before moving on.
digitalWrite(ledpin, LOW); //turns the light off.
delay(1000);
}
do not copy this. To upload click the arrow pointing to the right at the top left part of your screen. if you cannot find this use ctrl + u and it will upload.
Done
there you have it, Your first Arduino project! Feel free to change the code or modify it for learning more. Please paste any problems in the comments.