Skip to content

Instantly share code, notes, and snippets.

@ersatzavian
Created April 1, 2015 18:18
Show Gist options
  • Select an option

  • Save ersatzavian/7cf3054d2894591feba6 to your computer and use it in GitHub Desktop.

Select an option

Save ersatzavian/7cf3054d2894591feba6 to your computer and use it in GitHub Desktop.
Playing a 1s, 500 Hz tone with PinC on the imp002 EVB
//Playing a 1-second, 500 Hz beep
pwm <- hardware.pinC;
// configure PWM generator for 500 Hz, 50% duty cycle
pwm.configure(PWM_OUT, 1.0/500.0, 0.5);
// in one second, callback changes PWM duty cycle to 0% to stop tone
imp.wakeup(1, function() {
pwm.write(0.0);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment