Buzzer example for mbed apps board or shield
Fork of IoTWorkshopLCD by
main.cpp
- Committer:
- sam_grove
- Date:
- 2014-02-03
- Revision:
- 1:ac55ff7b1a7d
- Parent:
- 0:4ea8268e9d66
- Child:
- 2:0e7e13c81df4
File content as of revision 1:ac55ff7b1a7d:
#include "mbed.h" #include "C027.h" #include "C12832_lcd.h" //#define MBED_APPS_SHIELD #define MBED_APPS_BOARD DigitalOut myled(LED1); #if defined(MBED_APPS_SHIELD) PwmOut spkr(D6); #elif defined(MBED_APPS_BOARD) PwmOut spkr(p26); #else #error application board not defined #endif int main() { while(1) { for(int j=0; j<3; j++) { for (float i=2000.0; i<4000.0; i+=100) { spkr.period(1.0/i); spkr=0.5; wait(0.1); myled = !myled; } spkr=0.0; wait(2.0f); } } }