RPI boards have hardware pwm (2 channels). If you are using Audio, you have to be careful, as the onboard audio uses one of the pwm channels. CPU temp can be read with `vcgencmd`, which is in the rpi-vc.tcz extension.
You can set it up from about any programming language you want. Just google it. Most want to interface with temperature, so you might want to be a bit more specific.