Setting up Arduino IDE

Chances are, you picked up a Trinket because it is programmable with the Arduino IDE. The Pro Trinket uses the same core chip as Arduino UNO, and the 5V Pro Trinket uses the same clock rate and voltage so its pretty much a full Arduino-compatible, just smaller!

The only changes you may have to consider when adapting Arduino sketches are:

  • Pins #2 and #7 are not available
  • The onboard 5V regulator can provide 150mA output, not 800mA out
  • You cannot plug shields directly into the Pro Trinket
  • There is no Serial-to-USB chip onboard. This is to keep the Pro Trinket small and inexpensive, you can use any FTDI cable to connect to the FTDI port for a Serial connection
  • The bootloader on the Pro Trinket use 4KB of FLASH so the maximum sketch size is 28,672 bytes. The bootloader does not affect RAM usage.
Even though Trinket has a USB connector, it does not have a "Serial Console" capability, so you cannot use Serial to send and receive data to/from a computer without a seperate FTDI Cable!

Arduino IDE Setup

Just follow the steps in the Adafruit Arduino IDE setup guide to add Adafruit board support to the Arduino IDE to program Pro Trinket!

Don't forget to also install Windows drivers if you are using Windows, or setup udev on Linux

When you're finished installing the IDE come back to this page to continue the Pro Trinket guide.

Blink!

OK let's practice uploading a sketch by uploading the classic Blink sketch with the USB bootloader. This program with blink the onboard red LED that is connected to pin #13.

The sketch is in File->Examples->Basics->Blink

If you are using Linux you may have to be "root" running the Arduino program to have access to the USB port

Select the Pro Trinket 5V/16MHz (USB) or Pro Trinket 3V/12MHz (USB) board from the Tools->Board menu

Next go into the Tools -> Programmer menu and select the USBtinyISP programmer.

Plug in the Trinket, make sure you see the green LED lit (power good) and the red LED pulsing. Press the button if the red LED is not pulsing, to get into bootloader mode.

Click the Upload button (or select File->Upload)

If everything goes smoothly you should see the following (no red error messages) and of course, the red LED on the trinket will blink on/off once a second

Something Went Wrong!

If you get the error message avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)


That means the bootloader wasn't active. Make sure to press the button on the Trinket to activate the bootloader before clicking the Upload button. Also, check that you see the red pulsing LED on #13 that indicates the USB bootloader enumerated to your computer

Also, don't forget to install the Windows driver if you're using windows!

Last updated on 2016-09-02 at 10.30.51 PM Published on 2014-08-20 at 05.12.17 PM