Let's start! - mako

Mako
Mako
nome
Go to content
Arduino
Programming
Of course, microcontrollers don't know our language, so we have to learn theirs. PC language il called machine language, a sieries of low-level binary instrucion that rappresent the basic operations performed by the microcontroller.
Normally we use a high-level language, similar to our language, and in the case of Arduino we use C++. An appropiate program will translate the high-level language into the machine language. This is called compilation.
Once translated the program must be tranferred to the microcontroller memory. This is called loading, and even if i turn off the power, the program will remain loaded.


In fact, the Arduino language, isn't the authentic C++ language. In the language of the microcontroller many instructions and libraries were installed which semplified the programming experience for the novice user.รน

Let's start with an empty program!
Every sketch (file with .ino extention) must contain 2 blocks: void setup(), and void loop().

When the Arduino is turned on, the funcion setup is always performed first and only once. It is used to write the initial settings and parameters. At the end f this block loop function begins, where the main program is written. This function is runs cyclically until the power is turned off. (but the code still remains in the microcontroller memory)
In this example have been added two lines of comments (//). Comments are ignored by Arduino. You can also use /* and */ to write multi-line comments. Don't understimate their usefulness!

Arduino IDE
First thing to program Arduino is to download the Arduino IDE, Integrated Development Environment. It's a free cross-platform program, so it is available for Windosw, Linux and MacOS.
The installation is slightly different for these three systems.

Windows
Download from the Microsoft Store.

Linux
Type on the terminal the following lines:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install arduino
$ sudo yum install arduino
$ sudo yaourt -S arduino

or download the zip files on tha Arduino software page: https://www.arduino.cc/en/software

MacOs
Download the DMG files on the Arduino software page: https://www.arduino.cc/en/software


Details on Arduino IDE
There are some information you should know.



The six icons at the top are essential.
The first icon needs to check the code, find any problems and report them on the console (black line at the bottom, in the sencon photo).
The second one loads the code into the microcontroller.
The third icon creates a new empty file.
With the fourth icon you can open another of your sketches.
With the "save icon" you can save your sketch.
The last one opens the serial monitor, you will know later what is it.

Other important settings are the correct insertion of the board model and the PC port.
You can do this selecting this two items under the tools menu.






There are no reviews yet.
0
0
0
0
0
Back to content