Here is How To Understand and Perform a Very Basic Action With Arduino UNO Board – This is Your First Project With Arduino & External LED. What most of the tutorial websites on these kind of guides is that, they never explain “behind the scene”. Unless you are understanding how the program is controlling, Arduino, Adafruit and other websites will control your purchases. We will show you some funny stuffs. You need to setup Arduino Board rightly with your Mac or other computer first.
Your First Project With Arduino : Required Hardware
We will need :
- We hope you have a basic electronics components kit. Actually we need only one LED and some resisters with resistance like 220Ω, 270Ω r up to 2.2KΩ. We can determine and measure the resistance of registers by previously written methods.
- A breadboard.
- Some Jumper Wires.
- It is good to have the YuRobot Breadboard Power supply to do a funny thing with it.
Your First Project With Arduino & External LED : Hardware Setup
Most basic setup will be :
---
- On the Arduino UNO board, you will find the panel with DIGITAL printed on the board. Push one Jumper Wire with both end males to that GND hole. It is better to use a Blue colored Jumper Wire for maintaining the basic rule.
- On the opposite side of the POWER panel on the board, you will find the panel with DIGITAL printed on the board. On the 13th number hole (there is corresponding numbering on the board), insert a Jumper Wire with both end males to that 13th hole. It is better to use a Red colored Jumper Wire for maintaining the basic rule. Connect it to the Breadboard’s positive side.
- LEDs have one leg of short length. This is negative or cathode.
- LEDs have one leg of bigger length. This is positive or anode.
- If we directly put the LED with matching connection directly on board, it will work, but it will die sooner or later. Thats why we need a resister.
- Resister will be on the positive side.
- If we use 220-270Ω resister it glow nicely, if we increase the resistance the LED will become dull.
- Complete the setup first.
- Then connect the Arduino Board to your computer and load provided example’s Blink program. External LED will blink too. You can play with the program in the way we have shown here.
Circuit diagram is like this (only the pin will be 13 not 9) :
Your First Project With Arduino : Funny Thing
If you push the YuRobot Breadboard Power supply on the breadboard without connecting the power supply to board and the Red and Blue connection holes of breadboard with Arduino in the way we said, you actually need no LED, no register! The flow of electron is not controlled on this cheap power supply this board! The Power supply’s green LED starts to glow!
Your First Project With Arduino : Software Part
The Blink code provided is (we have not removed the commented out lines) :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /* Blink Turns on an LED on for one second, then off for one second, repeatedly. Most Arduinos have an on-board LED you can control. On the Uno and Leonardo, it is attached to digital pin 13. If you're unsure what pin the on-board LED is connected to on your Arduino model, check the documentation at http://www.arduino.cc This example code is in the public domain. modified 8 May 2014 by Scott Fitzgerald */ // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 13 as an output. pinMode(13, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(13, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } |
As we are initiating with pin 13 of Digital output of the Ardunio board:
1 | pinMode(13, OUTPUT); |
we are inserting the red colored jumper on 13th hole. If we change the value 13 to 8, we will change the position of the jumper to number 8 hole.
Try our program :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* Modified Blink https://thecustomizewindows.com GNU GPL 3.0 */ void setup() { pinMode(8, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(8, HIGH); // turn the LED on (HIGH is the voltage level) delay(5000); // wait for a second digitalWrite(8, LOW); // turn the LED off by making the voltage LOW delay(500); // wait for a second } |
We have set :
1 2 | digitalWrite(8, HIGH); // turn the LED on (HIGH is the voltage level) delay(5000); // wait for a second |
the glow = delay(5000);
to higher value but, off time :
1 2 | digitalWrite(8, LOW); // turn the LED off by making the voltage LOW delay(500); |
to very low – delay(500);
Now run this one and carefully look at the code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | int led = 8; int brightness = 0; int fadeAmount = 5; void setup() { pinMode(led, OUTPUT); } void loop() { analogWrite(led, brightness); brightness = brightness + fadeAmount; if (brightness == 0 || brightness == 255) { fadeAmount = -fadeAmount ; } delay(30); } |
First, the program is “compressed”. If we use so much comments, empty lines, we will die in bigger program for space issue. Second we are using analogWrite
here instead of digitalWrite
. Arduino’s this C/C++ language is not what exactly hugely loved.
Basically Python is better and there are ways to use Python on Arduino plus we do not need so much jazzy graphical user interface. Its too much for us, one command line is enough for us.
Tagged With arduino for external led , ARDUINO LED CONNECTION , external port connected led to myrio project program