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.
Just follow the steps in the Adafruit Arduino IDE setup guide to add Adafruit board support to the Arduino IDE to program Pro Trinket!
When you're finished installing the IDE come back to this page to continue the Pro Trinket guide.
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
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
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!