Support » Pololu Romi 32U4 Control Board User’s Guide » 5. Programming the Romi 32U4 Control Board »
5.2. Programming using the Arduino IDE
Programming the A-Star 32U4 from the Arduino IDE.
Our 32U4 family of boards can be programmed from the popular Arduino integrated development environment (IDE). The Arduino IDE is a cross-platform, open source application that integrates a C++ code editor, the GNU C++ compiler, and a program upload utility. To get started programming your device with the Arduino IDE (version 1.6.4 or later), follow these steps:
- Download the Arduino IDE from the Arduino Download page, install it, and start it.
- In the Arduino IDE, open the File menu (Windows/Linux) or the Arduino menu (macOS) and select “Preferences”.
- In the Preferences dialog, find the “Additional Boards Manager URLs” text box (highlighted in the picture below). Copy and paste the following URL into this box:
If there are already other URLs in the box, you can either add this one separated by a comma or click the button next to the box to open an input dialog where you can add the URL on a new line.
Adding a Boards Manager index for Pololu boards in the Arduino IDE’s Preferences dialog.
- Click the “OK” button to close the Preferences dialog.
- In the Tools > Board menu, select “Boards Manager…” (at the top of the menu).
- In the Boards Manager dialog, search for “Pololu A-Star Boards”.
- Select the “Pololu A-Star Boards” entry in the list, and click the “Install” button.
- After the installation finishes, click the “Close” button to close the Boards Manager dialog.
- In the Tools > Board menu, select the “Pololu A-Star 32U4” entry. If you do not see your device listed in the Board menu, try restarting the Arduino IDE.
Selecting the Pololu A-Star 32U4 in the Boards menu.
- In the Tools > Port menu, select the port for the device. On Windows you can determine what COM port the device is assigned to by looking at the “Ports (COM & LPT)” section of the Device Manager. On Linux, the port name will begin with “/dev/ttyACM”. On Mac OS X, the port name will begin with “/dev/tty.usbmodem”.
Windows 10 Device Manager showing the A-Star’s virtual COM port.
- Open up the “Blink” Arduino example, which can be found under File > Examples > 01.Basics > Blink. The code in this example will blink the yellow LED. When you select the Blink example, a new Arduino IDE window will open up. It is OK to close the first window.
Selecting the Blink example in the Arduino IDE.
- Press the “Upload” button to compile the sketch and upload it to the device. If everything goes correctly, you will see the message “Done uploading” appear near the bottom of the window. If you are using Windows and you have not previously programmed an A-Star device on this USB port, then Windows might take several seconds to recognize the A-Star bootloader. The bootloader times out after 8 seconds and goes back to running the sketch, so the upload might fail if Windows does not recognize it quickly enough. If this happens, try again. If you are using Windows XP and have not programmed an A-Star on this USB port, you will have to go through the Found New Hardware Wizard again as described in the previous section, but the second time you try to upload it should work. If the Arduino IDE has trouble connecting to the port or using it, try unplugging the device, closing any programs that might be using the serial port, restarting the Arduino IDE, and then plugging the device back in.
Uploading a sketch to the A-Star using the Arduino IDE.
- If you uploaded the Blink sketch, then the yellow LED should be blinking once every two seconds. However, we ship some A-Stars with that same example already programmed onto it, so you might not be convinced that anything has changed. Try changing the delay values in the sketch to something else and uploading again to see if you can change the speed of the LED.
The A-Star 32U4 boards are similar enough to the Arduino Leonardo that you do not actually have to install the add-on. If you want to, you can just select the “Arduino Leonardo” board in the Arduino IDE. Note that if you upload a sketch to the device this way, your computer will then recognize it as a Leonardo (for example, its entry in the Windows Device Manager will display “Arduino Leonardo”).
After you succeed in programming your device from the Arduino IDE, there are many resources you can use to learn more:
- The Arduino IDE has many examples that can run on A-Stars.
- The Arduino website has a Language Reference, a wiki called the The Arduino Playground, and other resources.
- The A-Star 32U4 boards are similar to the Arduino Leonardo and Arduino Micro, so you can search the Internet for relevant projects that use one of those boards.
- The Related Resources section lists many more resources.
Disabling ModemManager in Linux
If you are using Linux and have trouble following the instructions above, your issue might be caused by a program called ModemManager. This program automatically connects to serial ports and sends modem commands to them, interfering with other software using those ports. You can run
ps ax | grep -i Modem to see if ModemManager is running. On Ubuntu, the command to permanently disable ModemManager is:
sudo systemctl disable ModemManager