Computer

Are you going to program in Arduino? All you need to know

  • Galileo
  • arduino one
  • Leonard
  • Due
  • And a
  • three
  • ArduinoZero
  • ArduinoMicro
  • esplora
  • Mega ADK
  • Ethernet
  • Mega 2560
  • Robot
  • arduinomini
  • ArduinoNano
  • LilyPad Arduino Simple/ SimpleSnap
  • LilyPad Arduino / Arduino USB
  • Arduino Pro / Pro Mini
  • Trust
  • MKR1000
  • Arduino MICRO
  • Arduino 101
  • gem

In addition, there are different accessories (shields) that we can connect to these boards to provide them with more features and connections. The most common are:

  • GSM Shield
  • Ethernet Shield
  • Wi-Fi Shield
  • Wireless SD Shield
  • USB Host Shield
  • Engine Shield
  • Wireless Proto Shield
  • Proto-Shield

We can also find several kits that come with the microcontroller board and various additional accessories, buy accessories such as an LCD screen or USB adapters, and even a 3D printer controlled entirely by this device.

How to program in Arduino?

These boards are based on an ATMEL-type microcontroller, that is, a controller in which we can record instructions so that it executes them without having to enter the commands by hand over and over again. To write these instructions it is necessary to use a software called Arduino IDE, the official Integrated Development Environment that has everything necessary to be able to shape the programs that we create for this device.

Even though Arduino uses its own programming languagethis is based on C++. Therefore, it shares the main advantages of this programming language. Also, in newer versions of the IDE, it is even possible to send you the instructions directly in C++ without having to translate them into your own language to program this board.

In addition to using C++, the Arduino IDE also supports other alternative programming languages, such as C (without the C++ extensions), wiring (an electronic prototyping platform made up of a programming language, an integrated development environment (IDE) and a microcontroller), as well as in processing (a programming language based on Java, but focused on electronic boards).

Which is the best of all? In the end it will depend on the user in question. If we already master one of the previous languages, the most comfortable and quickest thing to do will be to use it to send instructions to our board. If we don’t master any of them, and we want to start from scratch, it is best to learn the Arduino IDE language itself.

IDE 2.0 (Arduino Pro)

In 2019, Arduino released a new programming IDE under the name “Arduino Pro IDE”, which was renamed in 2021 to “SDI 2.0«. This new development environment continues to use the classic Arduino CLI, but includes a large number of improvements and novelties of all kinds to facilitate the professional development of all kinds of projects. This new IDE is based on Eclipse Theia, and has features such as:

  • It is much more complete and modern.
  • Three modes of operation: Dual Mode, Classic Mode (identical to the classic Arduino IDE), and Professional Mode (file system view).
  • New Board Manager.
  • New LibraryManager.
  • For ARM boards, auto-complete from Basic.
  • Integration with GIT.
  • Dark mode.

This IDE can also be downloaded from the Arduino download website. And of course it’s completely free and open source.

First steps in programming

Programming for Arduino is not very different from doing it for any other microcontroller, and even from doing it in any programming language. We simply have to take into account the special characteristics of the IDE and the language that we are going to use.

Broadly speaking, the syntax it is very similar, as we have already explained, to that of C++. If we already know this programming language, we will surely get used to the changes that we will find to shape this system very quickly. While we program in the IDE we can add comments that will help us to better understand the code and, in addition, will help other people to understand it in case we share it. As in other languages, each statement must end with a comma (,) or semicolon (;), otherwise the compiler will treat everything as one statement and the compiler will return an error.

Within the syntax we will find another very important element: the variables. These will be used to save different information in memory, access it when we need it, and we can modify it according to the needs of the program.

And we must also take into account the functions, or methods. Especially those that are related to communication with the pins. For example, one of the most basic is «digitalWrite()«, which allows us, through parameters, to activate or deactivate the current in a specific pin.

arduino digital write

Other essential functions for programming are setup()the function that will be executed first as soon as the board is loaded and that will allow us to prepare the device for the program that we are going to execute, and the function loop(), a function that will be executed over and over again to update, for example, the information displayed on the screen. It is advisable to be careful with the latter, since the device will be locked inside it and we can lead to infinite loops.

When we have the program created, thanks to the Arduino IDE we can compile itor what is the same, translate it into machine language (a very low level language) so that it can be executed in the microcontroller.

Learn to program with Arduino

Within microcontroller programming, Arduino is one of the most accessible and versatile platforms to start with. In addition, the network is full of a large number of high-quality courses with which, even if we do not have much programming knowledge, we will be able to start creating our own projects very quickly and easily.

The first of the courses that we recommend to start is “Arduino Course from scratch“, which we can find on YouTube. Throughout its 74 chapters, each lasting between 15 and 20 minutes, we can learn from the basics to the most advanced.

Another course, for those who are in a hurry, that we should review is the “10 first steps to program arduino from scratch“, a fast and intensive course with which, in just 1 hour, we will be able to learn from what Arduino is to how they work. the main functions, variables, loops, and even use libraries.

Finally, if we are not afraid of English, another course we can use to learn how to program this device is Arduino 101 – Learn Arduino For Beginners. In a similar way to the previous ones, we will start with the basics until we thoroughly understand how this device works and learn how to create complex programs with it.

Of course, we also have a wealth of information and resources within the Arduino website itself. If you are one of those who likes to research and read documentation more than watching videos on YouTube, this is the best source you will find to learn how to program on it.

Arduino Projects

When we start to give the first ones with this device, the first thing we will do is create the typical thing to do with the IDE, the methods and its compiler. For example, we can create simple counters, a traffic light using LEDs, and, in the most advanced case, even a binary clock.

Once the basic part of the board is mastered, then we can move on to more serious projects using other additional components. For example, if we connect an LCD screen to the Arduino we can create our own digital clock.

Finally, when we have mastered this device, we will be able to create all kinds of projects, from the most basic and simple to the most interesting projects such as vending machines, and even a BB8 robot controlled from our mobile.

The possibilities are endless. Thanks to Arduino we will be able to automate our home in a very simple and cheap way, or carry out any work or project that must be executed by a machine. The limit is set by your imagination.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *