Chris Styles
/
SpeakerSawWave
Generate a 5kHz Saw Tooth wave, with 10 steps per cycle
Diff: main.cpp
- Revision:
- 0:162f44036057
diff -r 000000000000 -r 162f44036057 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Sep 13 14:05:22 2010 +0000 @@ -0,0 +1,12 @@ +#include "mbed.h" + +AnalogOut speaker(p18); + +int main() { + while (1) { + for (float i = 0.0 ; i <= 1.0 ; i += 0.1 ) { + speaker = i; + wait (0.00001); // 5kHz, with 10 steps + } + } +}