The Arduino Mega 2560 is based on the AVR ATmega2560 microcontroller.
Note: the AVR backend of LLVM is still experimental so you may encounter bugs.
Interface | Hardware Supported | TinyGo Support |
---|---|---|
GPIO | YES | YES |
UART | YES | YES |
SPI | YES | Not yet |
I2C | YES | YES |
ADC | YES | YES |
PWM | YES | YES |
Documentation for the machine package for the Arduino Mega 2560
The Arduino Mega 2560 needs a few extra dependencies to work, for example, if you get an error like this:
/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot find -lm
/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
Or like this:
/bin/sh: 1: avrdude: not found
To fix this, see the installation guide for Linux and for macOS.
Programs are loaded onto the Arduino Mega 2560 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.
tinygo flash -target arduino-mega2560 /path/to/code