Using the Arduino IDE on the Raspberry Pi for AdaFruit’s Boards.
In a previous post, we showed how to use the Arduino IDE on the Raspberry Pi to develop for ESP8266 boards. Here we will show how to configure the Arduino IDE on the Raspberry Pi to enable development with AdaFruit’s micro-controller boards. These boards include the Trinket, Pro Trinket, Gemma, and Flora.
Configuring the Arduino IDE for the Trinket and Other AdaFruit boards
Here is how to install the board managers for the AdaFruit boards.
Launch the Arduino IDE, click on the Arduino menu at the upper left, and select Preferences. The following appears:
For the field, Additional Boards Manager URLs: enter
https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
and click ok.
Go to the Tools menu and select Boards Manager. Now, at the top-left click on the pop-up for type and select Contributed. Select the Adafruit AVR Boards by Adafruit as shown below.
Press the Install button and then Close the Boards Manager.
Now under the Tools-Board menu you can select any of AdaFruit boards. I selected what I have, an AdaFruit Trinket 8 MHZ.
Configuring for Linux
Since the Raspberry Pi computer uses the Raspbian Linux distribution, you need to follow the Linux installation procedure provided by AdaFruit.
Go to:
On the left-hand side, click on Linux Setup.
Start your Raspberry Pi and open a Terminal window. Paste in the following code given in the Linux setup.
wget https://github.com/adafruit/Trinket_Arduino_Linux/raw/master/99-adafruit-boards.rules
Now copy the rules to their proper location.
sudo cp 99-adafruit-boards.rules /etc/udev/rules.d/
You should now reboot your Rasberry Pi.
Running the Blink Sketch
Use the File menu to select the Examples — 01.Basics — Blink sketch.
The sketch needs a few edits for the Trinket. Edit it as shown below.
int led = 1; // blink ‘digital’ pin 1 — AKA the built in red LED
void setup() {
pinMode(led, OUTPUT);
}// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000);
}
This sketch turns on the red LED on for one second, then off for one second, repeatedly.
To upload to your Trinket:
1) Select the proper board from the Tools->Board Menu
2) Select USBtinyISP from the Tools->Programmer
3) Plug in the Trinket, make sure you see the green LED lit
4) Press the button on the Trinket — verify you see the red LED pulse. This means it is ready to receive data
5) Click the upload button within 10 seconds
The red light on the Trinket should now be blinking.
More information about the Trinket can be found at:
https://learn.adafruit.com/introducing-trinket/downloads?view=all#introduction