Trinket Pro Interrupts

A project log for DaFunc

Simple pocket sized function generator

gannongannon 12/09/2014 at 18:022 Comments

As you may have noticed I have been prototyping my system on an Arduino Pro Mini rather than a Trinket Pro so far.

Although the system is the same on many levels there are a few distinct differences that need to be accounted for.

  1. The Trinket Pro has a USB bootloader in the firmware that reduces the usable code size by ~3kB
  2. The Trinket Pro uses 1 of the 2 external interrupts for USB
  3. Not all pins are avaiable on the Trinket Pro

Number 2 is the big one I didn't take into account so far in my code. I use an interrupt for reading the rotary encoder and another for reading a button press. After I realized this I was worried that I would need to start continually polling the inputs in a loop rather than using the external interrupts, but I have been saved!

It ends up you can set up an interrupt on any of the IO ports of the microcontroller. This means I can hook up all my inputs to a single port, interrupt on any change to that port, and then actually read each of the inputs to see what happened. More information on how to set up this type of interrupt is available at


Sean A wrote 12/13/2014 at 07:59 point
Gannon, I'm trying to apply the article you shared ( to my Adafruit Pro Trinket project. Namely I want to make pins 3, 5, and 15 act as change interrupts per the article you posted as pull-down switches. I'm struggling to modify the code on that article to target those pins. Is there any reference/link you have handy that could tell me how to change the "PCICR =0x02; and PCMSK1 = 0b00000111;" lines to pins 3,5, and 15 on the Trinket Pro? They are pull-down switches, not pull-up in my project.

  Are you sure? yes | no

gannon wrote 12/14/2014 at 05:08 point
The code at is a bit easier to use I think as it handles the low level access to PCICR for you through a function call

  Are you sure? yes | no