Programming Arduinos from Raspberry 4
Arduinos are frequently used together with Raspberries. Arduinos have builtin support for analog I/O and can work on realtime tasks while the Raspberry may be under heavy load. This makes them useful for example when working with many kinds of sensors.
An easy way to program Arduinos is to use the Arduino IDE, since it can automatically install required cross-compilers, download libraries and can also be extended to work with boards other than original Arduino ones.
The steps below assume you have an Adafruit Trinket M0 board.
- Head over to https://arduino.cc/en/Main/Software
- Download the Linux ARM version of the Arduino IDE
- Open a terminal and extract the downloaded programm:
cd Downloads && tar -Jxvf arduino-1.8.13-linuxarm.tar.xz
- Start Arduino IDE:
cd arduino-1.8.13; ./arduino
- go to File -> Preferences
- Add the board manager URL:
- go to Tools -> Board -> Boards Manager...
- Find the board you need, like Adafruit SAMD Boards, and install support
- Connect your Arduino with a USB cable to PI
- Go to Tools -> Port and select the correct port: likely
- Go to Tools -> Board and select your board (Adafruit SAMD -> Adafruit Trinket M0)
- Go to File -> Examples -> Basics -> Blink
- Click Upload
- Now if the power led is blinking, you're good to go