Arduino Nano

The Arduino Nano is based on the AVR ATmega328p microcontroller.

Note: the AVR backend of LLVM is still experimental so you may encounter bugs.

Interfaces

InterfaceHardware SupportedTinyGo Support
GPIOYESYES
UARTYESYES
SPIYESNot yet
I2CYESYES
ADCYESYES
PWMYESYES

Machine Package Docs

Documentation for the machine package for the Arduino Nano

Installing dependencies

The Arduino Nano needs a few extra dependencies to work, for example, if you get an error like this:

  1. /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot find -lm
  2. /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot find -lc
  3. collect2: error: ld returned 1 exit status

Or like this:

  1. /bin/sh: 1: avrdude: not found

To fix this, see the installation guide for Linux and for macOS.

Flashing

AVRDude

Programs are loaded onto the Arduino Uno using the avrdude command line utility program. You must install this program before you will be able to flash the Arduino Uno board with your TinyGo code.

  • Plug your Arduino Uno into your computer’s USB port.
  • Build and flash your TinyGo program using tinygo flash -target=arduino-nano