Hi there,

Try changing the speed variable to a BYTE !! Or just hardcode a 127 (50% duty cycle).

Did you use an oscilloscope to check for the 2KHz?

Regards
Sougata