The example program for mbed pin-compatible platforms
Dependencies: mbed
Fork of mbed_blinky by
main.cpp
- Committer:
- f3d
- Date:
- 2014-11-18
- Revision:
- 7:20b5bef5d206
- Parent:
- 4:81cea7a352b0
File content as of revision 7:20b5bef5d206:
#include "mbed.h" DigitalOut speaker(D2); void tone(float freq, float len) { float half_cycle; int cyclecount; half_cycle=(1.0/freq)/2.0; cyclecount=freq*len; while(cyclecount--) { speaker=1; wait(half_cycle); speaker=0; wait(half_cycle); } } int main() { while(1) { tone(261,0.5); wait(0.5); } }