Introduction: Arduino for Beginners
Arduino is an open source platform based on AVR microcontroller and it is great for rapid prototyping. You can use it to read analog or digital sensors and control various outputs like motors and LEDs. Basically it opens up a whole new vista of interacting with the world.
The most popular Arduino board out there right now is the Arduino UNO although there are other variants like the Arduino Mega which basically has greater number of I/Os(Inputs/Outputs). There is also the Arduino Lilypad which you can use in e-textiles with conductive thread acting as wires.
The on board capabilities of Arduino can be expanded with the help of "Shields" which serve some special purpose. For example, there are shields out there to connect to the internet, there are motor controller shields and so on and so forth.
So why would you want to work with Arduino? If you have a great idea for any project in mind and you want to test it out quickly, then you can build it with Arduino and see how it works. Also, it is great for artists or makers who don't want to go in depth of electronics but simply want to produce art with electronics.
We are going to be running a very simple program in this instructable which can be considered as the "hello world" of hardware. It will introduce you to the syntax and environment of Arduino which is pretty much based on C and C++. If you have a basic understanding of programming then things won't be difficult. Even if you don't understand the program, you can always dive right in and learn on the go.
Step 1: Materials
Step 2: The Arduino IDE
Next up, you will need to download the Arduino IDE(Integrated Development Environment). This is again a free open source software which can be downloaded from the Arduino website. This software is used to write the code and then upload it to the Arduino board. You can select the appropriate board(in our case Arduino UNO) by going into Tools ---> Board ---> Arduino/Genuino UNO.
Step 3: The Program
Like I said, in the beginning we'll be writing the hello world of hardware which is basically the simplest program you ever write. So we'll be using the delay function to blink the onboard LED on and off. The on board LED is connected to pin 13 of Arduino UNO. An Arduino program has two fundamental and essential parts. One is the setup function and the other is the loop function.
The setup function is used to configure the mode of I/O pins as either input or output. If we are connecting a sensor or a switch to the pin, we declare it as input and if we are connecting actuators to it like motors or LEDs we declare it as output. It can also be used to start the serial monitor besides some other functionality.
The loop function is the part of the program which repeats itself indefinitely. The main part of the program is found inside this function e.g in our case we send a HIGH signal to the LED with the digitalWrite function and keep it HIGH for 2 seconds and then we send a LOW signal to the LED and keep it LOW for 2 seconds and this keeps on repeating. The program file is attached and it will become clearer when you read the code. You can upload it to the board by clicking on the Upload button in the top left corner of the Arduino IDE.
So this is it. You are ready to kick off. What you have learnt from this program is to:
1) The purpose of setup and loop functions
2) How to configure I/Os
3) How to use digitalWrite and delay functions