Or you could look into an
Arduino. It's a controller that's pretty cheap ($30 or so) and can be programmed through a USB cable. It has an IDE which uses a language which is basically C. It can also output PWM signals, so it could be useful for your case.