The very first thing to do is to select the arduino board which suits the requirement. Visit the ]]>website]]> of arduino where one can get all the details about the arduino boards and arduino softwares. Beginners are recommended to use arduino duemilanove board or arduino ]]>uno]]> board. Those who are used to with handling the hardware things, soldering etc. can choose arduino ]]>pro-mini]]> board. All the details of the available arduino boards can be found from the arduino ]]>website]]> itself. This article and the following ones are explained based on the arduino pro-mini board and the IDE version 1.0.3 for windows. The advantage of this board is that it comes in very small in size; bread board compatible burg stick connectors can be soldered according to our requirements. It is very breadboard friendly and occupies very less space of a typical breadboard.
The only difficulty is that it requires another board to load the program into it through USB port. The compatible ]]>USB to TTL converter]]> board can be obtained from the nearest vendors or by online purchase. The two boards are so cost efficient that they together cost less than other basic arduino boards. The latest version of the arduino IDE can be ]]>downloaded]]> from the arduino website itself, available for windows, linux, mac etc. One have to simply copy the entire folder into a preferred location in your PC, open the folder click on the arduino icon and that’s it, no need to install. The programing language is based on C and any one has a basic idea can uickly get start with it. Moreover there is a separate ]]>page]]> discussing about the programming details only where one can refer all the details onarduino programming language.
If everything has been done in the correct way the arduino IDE opens up and it looks like the following image in windows;
The first step is to save the project in a folder which is selected to contain all projects and experiments with the arduino. Click file -> save as, select the required folder and give the file name. For all the experiments with the arduino it is recommended to create a folder named “ARDUINO WORKSPACE” and save this particular project as “_1_led_blinking”. Sketch names can only consist of ASCII characters and numbers (but cannot start with a number). They should also be less than 64 characters long. The arduino sketch is saved in the file format ‘.pde’.
Now go to the examples and find the basic led blinking code as shown in the following image;
Now a separate window with the code opens up which is not supposed by the user to edit, since it is a working code and should be kept as such for future references. Select all and copy paste the entire code into the _1_led_blinking window and close the new window with the ‘blink code’ safely.
All the arduino codes have a small description about it and about the hardware connections at the very beginning of the code file itself as marked inside the green box in the following image.
There is a built-in LED connected to the digital pin number 13 of the arduino pro-mini board and this particular code is for blinking that led with a delay.
An arduino code has two basic functions namely “setup ()” and “loop()”. The setup() is the function where all the initial settings like setting the pin as input/output, initializing the serial communication with baud rate etc. The loop() is actually an infinite loop inside which the rest of the code should be written. The user-defined functions if there is any should be written separately outside the setup() and loop() and can be called from inside both of them.
The function pinMode() is a built-in function used to set a particular pin as input or output. The first parameter is pin number and the second parameter suggests whether the pin should be input or output.
For example to make pin number 5 as output
pinMode (5, OUTPUT);
To make pin number 6 as input
In this particular example the pin13 is already defined as led using the statement
int led = 13
and hence came the following statement
which can make the 13th pin of the arduino board as output.
The digitalWrite() is another function which can be used to write a digital value (logic 0 or logic high) to a particular pin which has already been made as output using the pinMode() function.
For example to make the pin number 5 as logic high
And to make the same pin as logic low
The function delay () is a very useful function for almost all the projects and it can generate a delay in milliseconds between the code steps.
For example to generate a delay of 5 seconds,
Once the coding has been done its time to verify the code and arduino is so user friendly that people won’t get too many errors. There is a button for verifying the code at the top left corner of the IDE as shown below;
Once the verification has been done the code is ready to upload to the board. Connect the board to the USB port of the PC and install the driver which comes along with the board. After installing the driver come back to the arduino IDE and select the board from the list using tools>boards>arduino pro mini
After selecting the board, one should also select the COM port on which the board is connected as shown in the following image;
Now try to upload the code to the board by clicking the upload button as shown in the image below;
Now one can try changing the delay or connecting an external LED to another pin and all such basic things. No separate power supply is required as the arduino pro-mini board is USB powered.
Refer to the code and circuit for blinking an external LED connected to the pin number 5 of the arduino board.