I am supported by our readers and may earn a commission if you buy through our Affiliate Links at no cost to you. Thank you so much for your support. Read More
The trinket is a small microcontroller that costs just a few bucks. It it an ideal microcontroller for those smaller projects.
Connect To Arduino IDE
If you have not already downloaded the Trinket libraries, you’ll need to do that first. Go to the boards manager and add the trinket libraries.
When done, you can select the appropriate board under Adafruit Boards. Select Adafruit Trinket ATtiny 8MHz
No Serial Port
Now you may be surprised to learn that there is no serial port that you can select. That’s normal as it’s a virtual serial port.
Programmer
Select the USB TinyISP programmer.
Upload A Sketch
You are almost done. To upload the sketch, this is a bit different than most Arduinos. You can only upload sketches if the bootloader is active. Now how do you do that?
Red Pulsing LED – Active Bootloader
The bootloader is active when the red led is slowly pulsing. This is active when you first plug it in but it times out. Therefore, to re-activated it, press the reset button and upload the sketch while it’s pulsing.
Errors During Uploading
Here is a typical error you might receive if you attempt to upload when the bootloader is not active. Simply press the reset button and try again.
Arduino: 1.8.19 (Mac OS X), Board: “Adafruit Trinket (ATtiny85 @ 8MHz)”
Sketch uses 686 bytes (12%) of program storage space. Maximum is 5310 bytes.
Global variables use 9 bytes of dynamic memory.avrdude: error: usbtiny_transmit: Broken pipe
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.avrdude: error: usbtiny_transmit: Broken pipe
avrdude: error: usbtiny_transmit: Broken pipeThis report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.
Upload a test blink sketch and if all goes well the led will flash as you have specified in the sketch.
/* Blink Turns an LED on for one second, then off for one second, repeatedly. Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to the correct LED pin independent of which board is used. If you want to know what pin the on-board LED is connected to on your Arduino model, check the Technical Specs of your board at: https://www.arduino.cc/en/Main/Products modified 8 May 2014 by Scott Fitzgerald modified 2 Sep 2016 by Arturo Guadalupi modified 8 Sep 2016 by Colby Newman This example code is in the public domain. https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink */ // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(100); // wait for a second }