For this walkthrough, we will be discussing how to install and use the Arduino IDE on your HUZZAH32 Feather microcontroller board in order to get you started with your first embedded scripts. The HUZZAH32 Feather features the ESP32 SOC, which has the benefit of being programmable using either the MicroPython language or in the Arduino IDE. If your course requires MicroPython, please visit the Flashing MicroPython tutorial. Otherwise, strap in and get ready to start programming!

What is Arduino?

In order to be able to operate our microcontroller and get it to do some desirable function, we need to understand how to write in a language that it understands. There are many languages that can be used to program microcontrollers; however, the majority of contemporary architectures rely on the use of C/C++ (or a C-type language). The Arduino “programming language” is an example of a C++ dialect in that it uses C++ syntax and structure. In the last decade, Arduino has largely become the de facto standard for hobbyists, DIYers, and students toward their embedded systems projects. Arduino can be an attractive choice due to its dedicated user interface (Arduino IDE) and its thriving community of developers.

It turns out, actually, that Arduino is not really a language in the way that C++ is a language. It would be more appropriate to refer to Arduino as a platform for interfacing with microcontrollers. The Arduino platform features its own API, or application programming interface, that is often referred to as the Arduino language. However, the coding that you will be doing is C++ syntax arranged in a special way based on the rules of the Arduino API. We won’t go into too much detail about that here, but there are plenty of resources online to learn more.

A nice feature about the Arduino platform is that it comes with the Arduino integrated development environment (IDE) that you can use to code in the Arduino API and upload directly to your microcontroller over a USB connection. Other microcontroller platforms rely on a command-line interface, which is less user-friendly in many cases.

Installing Arduino

Our first step will be to download a special USB driver that is used to by your computer to recognize the HUZZAH32 Feather board. You can find the CP210X USB driver here. Make sure you are selecting the correct download option for your OS and architecture.

Next, you will install the latest stable version of Arduino here, which includes the Arduino IDE and a bunch of Arduino libraries necessary to get coding.

Once you have finished installing Arduino, you can start the program by clicking on the executable. You will be greeted by the Arduino IDE window and a script template that looks something like Figure 2.

Figure 2. The Arduino IDE interface.

There are many features here to discuss, but we will ignore most of it for now and focus on flashing your HUZZAH32 with a simple script that blinks your LED. Before we get to coding in the editor, the first thing we need to do is get the Arduino IDE to recognize your Adafruit HUZZAH32 Feather microcontroller. To do this, you will need to install a special library that has information that the Arduino IDE needs to read/write from your specific board. Navigate to File->Preferences.

In the Preferences window, you should see an option called “Additional Boards Manager URLs:” with a text field (see Figure 3). Copy the following URL into the field:

Figure 3. Additional Boards Manager URLs prompt.

Once you have done so, press OK to exit the Preferences window. Next, navigate to Tools->Board->“Boards Manager“. This will bring up the Boards Manager window where you will be able to install support for new boards. Type “esp32” in the top bar to search for the correct board package and install the EspressIf option as in Figure 4.

Figure 4. Boards Manager window with the correct package selected.

In addition to the board package, it will also be helpful for us to install some packages from EspressIf’s ESP-IDF API. ESP-IDF is EspressIf’s custom framework for working with ESP chip IoT implementations. You can find the instructions for installing these packages here under “Installation Instructions” and then “Using Arduino IDE with the development repository”. Make sure you select the correct installation instructions based on your OS.

Once that finishes, navigate again to Tools->Board. In this fly-out menu, search for an option that says “Adafruit ESP32 Feather” and select it. Your Arduino IDE can now recognize and interface with your board! Always make sure that you have the correct board selected or you will not be able to flash.

At this point, it is time to connect your microcontroller to your computer via your micro USB cable. Once you have connected your microcontroller, you should immediately see it begin flashing an LED rapidly, which indicates that it is receiving power.

USB devices like your microcontroller communicate over USB using serial protocol. For this serial communication to work, we need to identify the correct serial port (corresponding to your microcontroller) for the Arduino IDE to talk to. Navigate to Tools->Port. The fly-out menu should display at least one available port.

Depending on your OS, the naming convention of your Serial port will vary. If you are on Windows, it will likely be “COM1” or “COM2“. Linux might be “ttyUSB0” or “ttyUSB1“. If you have multiple available Serial ports in your menu and are unsure which to select, you can try disconnecting your microcontroller and observing which option disappears.


Finally, we are ready to write our first script, or “sketch” in Arduino terminology! You should see that your Arduino IDE has already populated your editor with some prewritten code structure and a name for your first sketch. This is the universal format for the Arduino API and consists of two main functions: setup() and loop().

void setup() {
  // put your setup code here, to run once:

void loop() {
  // put your main code here to run repeatedly:

The setup() function is run only once after the microcontroller boots. Typically, this is where you should take care of any one-time processes such as initializations, pre-allocations, and other setup tasks.

The loop() function, as the name suggests, is what will be run repeatedly in a perpetual loop after the setup() function has finished. Examples of processes that would go in loop() are tasks like analog reading/writing, communication protocols, controlling actuators, and more.

There will be plenty more opportunities to dig into the details of Arduino etiquette and C++ syntax. For now, let’s try writing a script that can blink the onboard LED of your HUZZAH32 Feather. Take a look at the following code.

#define led 13

void setup() {
  // put your setup code here, to run once:
  pinMode(led, OUTPUT);

void loop() {
  // put your main code here to run repeatedly:
  digitalWrite(led, HIGH);
  digitalWrite(led, LOW);

Let’s unpack this one new line at a time. The first addition is a #define led 13 on line 1. Here, we tell our microcontroller to create a macro led that returns the value 13. This number represents the pin number corresponding to our onboard LED.

In the setup() function, we call a function called pinMode() that assigns a mode to a particular pin on the microcontroller and takes two arguments. The first argument is the pin number and the second argument is the pin mode. As you can see, we have assigned the onboard LED pin to be an OUTPUT.

Changes to the loop() function include a sequence of two functions: digitalWrite() and delay(). The digitalWrite() function takes a digital pin (configured as an OUTPUT) and assigns it state of either HIGH or LOW corresponding to on and off respectively. The second function delay() is simply a function that performs a time delay of a certain number of milliseconds. In this case, it is waiting for 1000ms or 1 second.

That’s all there is to it! Let’s try first verifying the script and then uploading it to our microcontroller.

In the top left of your Arduino IDE, you should see two circular buttons (one with a check mark and the other with an arrow). The check mark is Verify and the arrow is Upload. Click the Verify button first to verify your script. This will prompt the Arduino IDE to ask you to save your sketch and then attempt to compile your code while checking for errors. You can save your file anywhere.

At the bottom of the Arduino IDE, you should see a black window with some text (we call this the console panel). This is where the Arduino IDE prints information such as compiler and error messages. Once the verification process finishes, you should see a message between the console panel and editor saying “Done compiling”, which indicates a successful verification.

With your microcontroller connected, click on Upload to begin uploading your script to your microcontroller. Assuming everything goes smoothly, you should see a message saying “Done uploading”. If you run into issues, double check that you have the correct Board and Port selected under Tools.

Take a look at your microcontroller! You should see an additional LED start blinking in one second intervals.

Congratulations! You have successfully programmed your HUZZAH32 Feather board with its first Arduino program!


Leave a Comment.