rev1

Dependencies:   4DGL-uLCD-SE EthernetInterface NTPClient SDFileSystem mbed-rtos mbed wave_player PinDetect

Fork of WavePlayer_HelloWorld by jim hamblen

Revision:
3:5f0b28699a67
Parent:
2:4d370e3f4618
Child:
4:55035e20ae61
--- a/main.cpp	Fri Apr 22 17:05:16 2016 +0000
+++ b/main.cpp	Fri Apr 22 17:15:19 2016 +0000
@@ -8,14 +8,16 @@
 #include "NTPClient.h"
 #include "uLCD_4DGL.h"
 #include "rtos.h"
-
+#include "PinDetect.h"
 
-
+//pinouts 
 SDFileSystem sd(p11, p12, p13, p14, "sd"); //SD card
-
 AnalogOut DACout(p18);
-
 wave_player waver(&DACout);
+PinDetect snooze(p19);  //snooze button
+PinDetect off(p20);     //turn alarm off
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
 
 // Parameters
 char* domain_name = "0.uk.pool.ntp.org";
@@ -31,6 +33,7 @@
 //global variables
 time_t ct_time;
 
+//time thread
 void time_thread(void const *args)
 {
    
@@ -46,9 +49,26 @@
     }
 }
 
+//pushbutton (p19)
+void snooze_hit_callback (void)
+{
+     myled1 = !myled1;
+}
+
+void off_hit_callback (void)
+{
+    myled2 = !myled2;
+}
+
 int main()
 {
-
+    snooze.mode(PullUp);
+    off.mode(PullUp);
+    wait(0.01);
+    snooze.attach_deasserted(&snooze_hit_callback);
+    off.attach_deasserted(&off_hit_callback);
+    snooze.setSampleFrequency();
+    off.setSampleFrequency();