Tuesday, January 7, 2014

Trinket Pin Mapping for AnalogRead and AnalogWrite

The simple answer to using AnalogRead and AnalogWrite on the Trinket, the pins numbers are not the same as the labeled digital pin numbers. Also not all of the pins that can be used for AnalogRead, can be used for AnalogWrite.  The pins are labeled for digital Read and Write. Here is the mapping:

Digital Pin 0 -> analogWrite(0)
Digital Pin 1 -> analogWrite(1)
Digital Pin 2 -> analogRead(1)
Digital Pin 3 -> analogRead(3)
Digital Pin 4 -> analogRead(2)

More information on the pins and can be found here:
http://learn.adafruit.com/introducing-trinket/pinouts