In this lesson, you will learn how program your Arduino to make the Arduino's built-in LED
blink.
The Arduino has rows of connectors along both sides that are used to connect to electronic devices and plug-in 'shields' that allow the Arduino to do more.
However, the Arduino also has a single LED that you can control from your sketches. This LED is built onto the Arduino board and is often referred to as the 'L' LED as this is how it is labelled on the board.
The position of this LED is circled in red on the pictures of the Arduino Uno below.
The Arduino IDE includes a large collection of example sketches that you can load up and use. This includes an example sketch for making the 'L' LED blink.
Load the 'Blink' sketch that you will find in the IDE's menu system under File>Examples>01.Basics
When the sketch window opens, enlarge it so that you can see the whole of the sketch in the window.
Saving a Copy of 'Blink'
The example sketches included with the Arduino IDE are 'read only'. That is, you can upload them to an Arduino board, but if you change
them, you cannot save them as the same file.
We are going to change this sketch, so, the first thing you need to do is save your own copy that you can change however you like.
From the File menu on the Arduino IDE select the option 'Save As..' and then save the sketch with the name 'MyBlink'.
You have saved your copy of 'Blink' in your sketchbook. This means that if you ever want to find it again, you can just open it using the File>Sketchbook menu option.
Uploading Blink to the Board
Attach your Arduino board to your computer with the USB cable and check that the 'Board Type' and 'Serial Port' are set correctly.
The Arduino IDE will show you the current settings for board at the bottom of the window.
If you watch the status area of the IDE, you will see a progress bar and a series of messages. At first it will say 'Compiling Sketch..'. This converts the sketch into a format suitable for uploading to the board.
Next, the status will change to 'Uploading'. At this point, the LEDs on the Arduino should start to flicker as the sketch is transferred.
Finally, the staus will change to 'Done'.
The other message tells us that the sketch is using 1,084 bytes of the 32,256 bytes available.After the 'Compiling Sketch..' stage you could get the following error message:
The clue is at the top here, it probably means that your board is not connected at all, or the drivers have not been installed (if necessary) or that the wrong serial port is selected.
If you get this, check if the board is connected and that you selected the right board and port.
Once the upload has completed, the built-in LED must start blinking.
Is there a proper way of placing the IC on the socket?
ReplyDeleteThank you for asking Shena. There is, definitely. You just have to follow the the right position of the notch to get rid of the wrong connection. It is also important to remember that if you are handling the MCU (Microcontroller Unit), do not hold the pins with your hands, simply hold it on the plastic housing.
DeletePlease let me know if I addressed your question. :)
Ma'am is there a difference between burning in ALEXAN ATMEL PROGRAMMER and ARDUINO BOARD?
ReplyDeleteThanks for asking Alyssa. There are a lot of differences. First, the materials are different. Second the Programmer is different. Actually I don't see any other similarity aside from selecting the port to be used. In simple words there is no way of comparing Burning in ALEXAN ATMEL PROGRAMMER and Burning in ARDUINO BOARD.
DeleteHi Maam Micah! How will I know the port I am connecting to?
ReplyDeleteGlad you asked Christine. The port where your Arduino Board is connected to is indicated at lower-right corner of the Arduino IDE. In the example above, in the Uploading Blink to the Board", right after the Board you are using it says "Arduino Uno on COM4". It means that your board is connected to PORT 4.
DeleteHi ma'am Micah! aside from built-in led can i use an external led for testing blinking led?
ReplyDeleteThanks for your curiosity Carmela.
DeleteYes of course. Aside from the built-in LED you can use an extra LED. You just have to connect it to Digital Pin 13 on the Arduino Uno board.
Ma'am how can I fixed if the serial port is not connected or not found?
ReplyDeleteWhat OS are you using?
DeleteMa'am the OS I'm using is windows 7
DeleteThank you Cheska. For Windows (generally), if the software is slow to start or crashes on launch, or the Tools menu is slow to open, you may need to disable Bluetooth serial ports or other networked COM ports in the Device Manager. The Arduino software scans all the serial (COM) ports on your computer when it starts and when you open the Tools menu, and these networked ports can sometimes cause large delays or crashes.
DeleteYou can also check if you're not running any programs that scan all serial ports, like USB Cellular Wifi Dongle software (e.g. from Sprint or Verizon), PDA sync applications, Bluetooth-USB drivers (e.g. BlueSoleil), virtual daemon tools, etc.
If the Serial Port is still not found, make sure you don't have firewall software that blocks access to the serial port (e.g. ZoneAlarm).
You may need to quit Processing, PD, vvvv, etc. if you're using them to read data over the USB or serial connection to the Arduino board.
You may also want to check the Physical Connection.
DeleteFirst make sure your board is on (the green LED is on) and connected to the computer.
The Arduino Uno and Mega 2560 may have trouble connecting to a Mac through a USB hub. If nothing appears in your "Tools > Serial Port" menu, try plugging the board directly to your computer and restarting the Arduino IDE.
Disconnect digital pins 0 and 1 while uploading as they are shared with serial communication with the computer (they can connected and used after the code has been uploaded).
Try uploading with nothing connected to the board (apart from the USB cable, of course).
Make sure the board isn't touching anything metallic or conductive.
Try a different USB cable; sometimes they don't work.
I hope you can fix your problem with all these guides at hand.
What kind of IC is use in Arduino board?
ReplyDeleteGlad you asked Lester. The kind of IC depends upon the type of board. But if you are referring to the one being used in Aruino Uno (the board used in this example), we used ATmega328P.
DeleteFor the complete reference about the Arduino Boards, visit this link https://learn.sparkfun.com/tutorials/arduino-comparison-guide
Ma'am how do we know if our program is working?
ReplyDeleteNice question Lulu. Well, as soon as you finished writing your program in the Text Editor of the Arduino IDE, you can click the Verify button on the Toolbars, the one with the check (✔) symbol. If something is wrong with your program or sketch, the error will be displayed in the message area. In simple words, if an error is displayed your program is not working.
DeleteI hope this helps.
Ohh! Thank you ma'am. :)
DeleteYou're very much welcome Lulu :)
DeleteMa'am how do we know if the IC is incapable for burning?
ReplyDeleteNice question Jenelyn. We can say that an IC is incapable of burning when it is totally damaged. To know if the IC you are using is damaged, try the following steps.
Delete1. Try it in a minimal circuit.
2. See if you can program it.
3 Make a test board that has an LED with series resistor to each output and run a simple LED flash program.
This covers 99.9% or more of faults. Most micro-controllers either work or do not.
If you are worried about the last 0.1% or less, then write test programs for each peripheral.
If the IC does not respond properly to any of this, you can replace it with a new one. Hope this helps.
Ma'am what is the advantage of using the arduino instead of the Alexan Atnel Training Module?
ReplyDeleteglad you asked Hannah. The biggest advantage of Arduino is its ready to use structure. As Arduino comes in a complete package form which includes the 5V regulator, a burner, an oscillator, a micro-controller, serial communication interface, LED and headers for the connections. You don't have to think about programmer connections for programming or any other interface. Just plug it into USB port of your computer and that's it.
ReplyDeleteSecond, another big advantage of Arduino is its library of examples present inside the software of Arduino. Libraries contain the necessary code for a specific device or component for example you are using a sensor (DHT11 to be specific), if you install the library it will automatically communicate with the board you are using. Lastly, Arduino has a large community. If you have questions regarding the codes or the hardware you can find help easily in the forums available in the Internet.
Ma'am Micah! Can I run first the program in Proteus 8.1 before I burn the program in Arduino Uno board?
ReplyDeleteGood question Christian. Yes you can run the program in in Proteus 8.1 before burning in Arduino Board even in Proteus 7.
DeleteYou will need to download and install the Arduino Proteus Library in doing this. Also, you have to save your sketch as a hex file (with the file extension .hex).
1. Copy the ARDUINO.IDX, ARDUINO.LIB from the Arduino-Proteus Library into the Library Folder of Proteus.
2. Load .hex file to the Arduino board in your circuit design in Proteus. Just double click on the board and browse the .hex file in the Program File section.
You can now see the simulated output of the Arduino Program by Running the Simulation. Hope this one helps. :)
For complete reference go to: http://www.circuitsgallery.com/2014/10/arduino-simulator-using-proteus.html
Is Arduino is commonly used in robotics?
ReplyDeleteGlad you asked Alfred. Yes! Nowadays, Arduino is widely used all around the world not just in robotics but in thousands of different projects because it is inexpensive and a lot of libraries are available for download in the internet . Another thing is that Arduino has a big community including the forums. This forums are very helpful whenever you seek for help every time you encounter a problem with your own project.
Delete