The standard Arduino IDE servo library will not work with 8 bit AVR microcontrollers like the ATTiny85 on the Trinket and Gemma due to differences in available timer hardware. Fortunately the SoftwareServo library, available at http://playground.arduino.cc/ComponentLib/Servo, works well on any available pin (a hardware PWM (pulse width modulated) pin is not required). The library is not ideal, in that servos must be refreshed periodically (see the Arduino site for an explanation). A true hardware library would be best if one could be coded, although it would be limited to pins capable of hardware PWM (GPIO #1 and #4).
If you turn the potentiometer, the servo will rotate from zero to 180 degrees. The circuit can be expanded into a number of useful projects.
- Adafruit Trinket (You can use either the 3V or 5V version here as the power will come from USB or a battery pack). This tutorial can also be done with a Gemma, although the wiring is a little different of course
- USB cable for power and reprogramming