Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor
Fork of TFT_Mikroelectronika_IL9341_sketchpad by
buzzer.h
00001 00002 #include "mbed.h" 00003 DigitalOut gnd(PTA4) 00004 gnd = 0; 00005 PwmOut 00006 buzzer(PTA5); 00007 float frequency[]={659,554,659,554,550,494,554,587,494,659,554,440}; 00008 //frequency array 00009 float beat[]={1,1,1,1,1,0.5,0.5,1,1,1,1,2}; 00010 //beat array 00011 int 00012 main() { 00013 while (1) { 00014 for ( 00015 int 00016 i 00017 =0; 00018 i 00019 <=11; 00020 i 00021 ++) { 00022 buzzer.period 00023 (1/(frequency[ 00024 i 00025 ])); 00026 // set PWM period 00027 buzzer=0.5; 00028 set duty cycle 00029 wait(0.5*beat[ 00030 i 00031 ]); 00032 hold for beat period 00033 } 00034 } 00035 }
Generated on Thu Jul 14 2022 09:34:11 by
1.7.2
