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

Committer:
Owenmatthewmcgowan
Date:
Fri May 26 09:37:06 2017 +0000
Revision:
49:243b5e826228
Parent:
42:5d9ccb16c8ef
merge;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Owenmatthewmcgowan 29:684e2a3e17b5 1
Owenmatthewmcgowan 29:684e2a3e17b5 2 #include "mbed.h"
Owenmatthewmcgowan 29:684e2a3e17b5 3 DigitalOut gnd(PTA4)
Owenmatthewmcgowan 29:684e2a3e17b5 4 gnd = 0;
Owenmatthewmcgowan 29:684e2a3e17b5 5 PwmOut
Owenmatthewmcgowan 42:5d9ccb16c8ef 6 buzzer(PTA5);
Owenmatthewmcgowan 42:5d9ccb16c8ef 7 float frequency[]={659,554,659,554,550,494,554,587,494,659,554,440};
Owenmatthewmcgowan 42:5d9ccb16c8ef 8 //frequency array
Owenmatthewmcgowan 42:5d9ccb16c8ef 9 float beat[]={1,1,1,1,1,0.5,0.5,1,1,1,1,2};
Owenmatthewmcgowan 42:5d9ccb16c8ef 10 //beat array
Owenmatthewmcgowan 42:5d9ccb16c8ef 11 int
Owenmatthewmcgowan 42:5d9ccb16c8ef 12 main() {
Owenmatthewmcgowan 42:5d9ccb16c8ef 13 while (1) {
Owenmatthewmcgowan 42:5d9ccb16c8ef 14 for (
Owenmatthewmcgowan 42:5d9ccb16c8ef 15 int
Owenmatthewmcgowan 42:5d9ccb16c8ef 16 i
Owenmatthewmcgowan 42:5d9ccb16c8ef 17 =0;
Owenmatthewmcgowan 42:5d9ccb16c8ef 18 i
Owenmatthewmcgowan 42:5d9ccb16c8ef 19 <=11;
Owenmatthewmcgowan 42:5d9ccb16c8ef 20 i
Owenmatthewmcgowan 42:5d9ccb16c8ef 21 ++) {
Owenmatthewmcgowan 42:5d9ccb16c8ef 22 buzzer.period
Owenmatthewmcgowan 42:5d9ccb16c8ef 23 (1/(frequency[
Owenmatthewmcgowan 42:5d9ccb16c8ef 24 i
Owenmatthewmcgowan 42:5d9ccb16c8ef 25 ]));
Owenmatthewmcgowan 42:5d9ccb16c8ef 26 // set PWM period
Owenmatthewmcgowan 42:5d9ccb16c8ef 27 buzzer=0.5;
Owenmatthewmcgowan 42:5d9ccb16c8ef 28 set duty cycle
Owenmatthewmcgowan 42:5d9ccb16c8ef 29 wait(0.5*beat[
Owenmatthewmcgowan 42:5d9ccb16c8ef 30 i
Owenmatthewmcgowan 42:5d9ccb16c8ef 31 ]);
Owenmatthewmcgowan 42:5d9ccb16c8ef 32 hold for beat period
Owenmatthewmcgowan 42:5d9ccb16c8ef 33 }
Owenmatthewmcgowan 42:5d9ccb16c8ef 34 }
Owenmatthewmcgowan 29:684e2a3e17b5 35 }