Hello World with Arduino

In 2005, I came across a project called Arduino, which drew my attention since it was a project of open source hardware. At the same year, I tried to assemble one but I ended leaving the project aside due to the college activities. Today, I regret I haven’t dedicated more some time to this project in the past, given the way it grew.

For those who don’t know, Arduino is a project composed by hardware and software for the development of applications which interact with the real world using sensors and actuators. It was conceived to permit the creation of projects by people who don’t have much knowledge on hardware or electronics such as hobbyists, artists and designers.

There are a lot of Arduino versions available, from the most common, called Arduino Uno to special ones like the LilyPad Arduino which was meant to be sewn on clothes. Besides that, one of the most interesting features of the project is the possibility to install shields, which are expansion boards that easily enables to use Arduino on applications such as ethernet, bluetooth, motor control, etc.

The applications depend only on the creativity of the developer :-). Check out some examples:

It took a while but I began to learn a little about the platform. Today, it is very easy to obtain an Arduino. On the project site, there is a list of stores that sell the “original” Arduino but since it is an open hardware platform, there are other manufacturers that sell arduino-like boards, that can be found on eBay or on Deal Extreme.

Like I mentioned, Arduino also includes a software project, including a development environment which eases the process of programming the microcontroller. In this environment, you can type your program and upload it to the Arduino board through a USB cable very easily.

I haven’t developed anything interesting on Arduino yet but, to have an idea of a program, here is an example of a program that blinks a LED connected to port 13, also known as the “Hello World” program on Arduino:

int ledPin = 13;                 // LED connected to pin #13

void setup()
{
  pinMode(ledPin, OUTPUT);      // configures the digital pin as output
}

void loop()
{
  digitalWrite(ledPin, HIGH);   // turns on the led
  delay(1000);                  // waits 1 second
  digitalWrite(ledPin, LOW);    // turns off the led
  delay(1000);                  // waits one second
}

The programming language is based on the Wiring Language, which is based on Processing and has a syntax similar to C. Basically, the program consists of two functions: setup and loop. The setup of the project is done on the setup function, in this case, the configuration of the LED pin as an output. The loop function, houses the code that will be executed indefinitely by the microcontroller. In this case, the LED will be turned on followed by a pause of one second and, after that, it will be turned off followed by a pause of one second.

For a first contact with Arduino, I recommend the book “Getting started with Arduino“, by Massimo Banzi, which is one of the creators of the project. In this book, basic functions to interact with sensors, actuators and the serial port are described. Besides that, it’s worth looking for a Hackerspace to visit on your town, where there usually are lots of interesting stuff using Arduino.

Comments

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>