Contains the main execution of the clock uses headers to import functions

Dependencies:   RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor

Fork of TFT_Mikroelectronika_IL9341_sketchpad by Oxford CWM Team

buzzer.h

Committer:
Owenmatthewmcgowan
Date:
2017-05-26
Revision:
49:243b5e826228
Parent:
42:5d9ccb16c8ef

File content as of revision 49:243b5e826228:


#include "mbed.h"
DigitalOut gnd(PTA4)
gnd = 0;
PwmOut
    buzzer(PTA5);
            float frequency[]={659,554,659,554,550,494,554,587,494,659,554,440};
            //frequency array
            float beat[]={1,1,1,1,1,0.5,0.5,1,1,1,1,2};
            //beat array
    int
    main() {
    while (1) {
    for (
        int
        i
        =0;
        i
        <=11;
        i
        ++) {
            buzzer.period
            (1/(frequency[
            i
            ])); 
            // set PWM period
                buzzer=0.5;
                set duty cycle
                wait(0.5*beat[
                i
                ]);
                hold for beat period
                }
        }
}