Arduino programming

Step by step how to use it

Do you want to start with Arduino? don’t you know how to start with it?
I’m going to teach you the first thing that you need to know to do your first projects!.

In case you know what is Arduino but you never use it: Let’s start to use it

What is Arduino?

Arduino is an open-source electronics platform based on easy-to-use hardware and software.

The Arduino software, known as IDE, it’s open-source and free. It’s available in the oficial page (although later I will teach you step by step how to install it).
To programming with Arduino, it’s used the programming language Processing. It’s very used by artists, designers and other persons who want to do projects without experience with electronic.

Some parts of Arduino

In this case, i’m going to use Arduino UNO to teach you, because it’s the most used.

arduino-uno

The microcontroller
It’s the ATMega 328. It’s the brain of the Arduino. It takes care of the funcionality of the board. It is on a base, so it allows us to remove it and change it in case it
burn (this is the only Arduino model that allows us to do this).

The power connector
It allows us to connect Arduino to a power suply (5 V- 12 V). The USB connector, allows us to connect it to a computer. It’s the one we will most use (load the program, test, communicate by serial port).

Then pins
Those that are above are the pins of digital input/output. And those that are marked with the symbol ~ are the PWM pins.
Those that are on the other side (name as A0 to A5) are analog reading pins.
The power pins are GND, 3.3V and 5V. These allow us to power the circuits.

Start!

Installation of Arduino Drivers

I’m going to teach you using Arduino UNO R3, but it’s the same with other models.

1) Connect the Arduino to the computer with the miniUSB cable or microUSB cable. It’s depends on your Arduino’s model.

2) Your computer’s Operating System will detect a new device and the automatic installation of the drivers will begin.

drivers

In case that does not happen, look for the model of your Arduino in Google and download the drivers. If you can not do it, contact us.

3) After that, the device is ready to use.

How to install Arduino IDE in WINDOWS

The IDE program allows you to write code in Arduino board in a simple programming language.

1) Go to https://www.arduino.cc/en/Main/software and download the Arduino IDE. (Windows Installer)

2) Run the program and follows the step to install it. (It’s very easy!)

Important!

If during the installation the program ask you if you want to install different softwares devices , be sure to do that. (You will be installing the most commons softwares devices)

3) After that, you can start to code!

ide arduino
Main view of Arduino IDE.

interface

Programming structure

The setup structure is the configuration of our programm. Here you will initialize variables, declare pins, etc. This structure will be executed only once when the Arduino turn off.

The loop structure runs eternally while the Arduino is on. In this loop you should write your programm, reading of data, update of variables, sensors control, etc.

The functions are connected within {}. These {} determine where the function start and end.

Verifying that the device works correctly:

1) Go to File - Examples - 01.Basics - Blink.

ide examples
Step by step how to verify that the device works correctly.

2) After that, a new window will be open (New Sketch or New Programm)

3) You will see code. That code is an a scheduled example and you can use it to verify the correct operation of the microcontroller.
when you execute the code, you will see a LED flashing in the Arduino.

Running the code

• Connect the Arduino in the computer through the USB port.

• Go to Tools - Board - Choose Arduino/Genuino UNO (the model that you are using).

Arduino

• Click in the upper left arrow. (doing this will make it compile the code and send it to the Arduino).

row

• If you see this error in the console, be sure to check if you connect correctly the Arduino in the computer and try again.

error

If the error doesn’t disappear, go to Tools - Port - and select the available port (e.g: COM3). Try again.

port

• Wait a few seconds until the code is loaded in the Arduino. Finally, you will see that in the microcontroller a LED start flashing. That’s means you can start to use it.

loading

In the next post, i’m going to explain how to use Arduino’s pins.


Leave a comment