I am trying to do the same on my Netduino. May I know what the timer is used for ? When I try to just set the pulse using the SetPulse command with appropriate inputs, an unhandled exception pops up and the speaker just keeps producing a particular frequency.
static void play(int tone, int duration) { PWM speaker = new PWM(Pins.GPIO_PIN_D6); uint period = (uint)(tone); speaker.SetPulse(period, period/2); Thread.Sleep((int)(duration / 1000)); }
Here is what i use to play the song. The above function is called from other which gives it the period(of the pulse) and the duration for which it is played..