Control things with a potentiometer.  Based on Adafruit's RPi volume control tutorial.