Re: Trinket Pinout Diagram
Ok, I have the data on input pullups:
You can set an input pullup by using pinMode(pin, INPUT_PULLUP); which ties about a 20K resistor from the pin internally to the supply voltage (5V or 3V for Trinket 5V and 3V respectively).
The internal pullup is used often for detecting a switch change. you can connect a switch from the pin and the other side of the switch to ground.
The 3V and 5V Trinkets act a bit differently it turns out:
For the 3V, using external power on BAT+ for any pin (USB for pins 0-2), the switch and INPUT PULLUP will work as expected (The pullup makes the default digitalRead HIGH, press the button and digitalRead returns LOW).
For the 5V Trinket, all pins work but pins 1 and 4. Yes 4. If you need to read a switch on those pins, use a 1000 ohm resistor from the pin to 5 volts to pull it high then the switch will work to pull it low.
In other news, if you set a pin as INPUT or OUTPUT, the pin will register 0 volts unless raised high except Pin 3 on each that is pulled to 3.2 volts because of the USB pullup resistor onboard.
If you want to test things easily, write a short program to digitalRead a pin and switch Pin 1 (Red LED) on/off depending on the value read. Helps in debugging without the serial monitor.