Arduino/AVR tutorial

Ready to build your first robot under 3h?

Download as .zip Download as .tar.gz View on GitHub

Hello world!

Contents

This is a quick walkthrough to install your very first application on a microcontroller. It’s the only section that does not require any software experience :)

Arduino IDE

Launch your Arduino IDE, you should see something like this (AD2023): Arduino IDE empty window

Now click on the drop-down list and select ‘Select other board and port…’:

Arduino IDE: Selecting the right board

Type in “Nano” and select non-default port:

You’re doing well! By now, your IDE should be prepared for action. Let’s compile an app. Go to File -> Examples -> 01.Basics -> Blink

The IDE shall present you a few lines of code that periodically turn on and turn off an LED that comes with your dev board. Note LED_BUILTIN constant, we’ll take about it later.

Now it’s time to compile it! There are three buttons in your toolbar (the area under File | Edit | Sketch | Tools | Help menu bar).

The tick button compiles your application. In other words, it translates the text you wrote (or in this case, the code you simply downloaded) into a binary file.

The right arrow button compiles and upload the application to the device you selected earlier on a given port.

Click the right arrow button. As a result, you should see a window like this:

Arduino IDE: Compiling and uploading the firmware

Take a look at your board! Do you see it?! It’s blinking! Good job, you’ve just become an embedded developer :)

More on Blink example can be found on Arduino website 1.

VSCode + PlatformIO project

Install the IDE as shown here:

More on Blink example can be found on Arduino website 1.

References