Coursework

Revision:
9:cdd7d9a123f9
Parent:
8:770d168713cc
Child:
10:42e70b596099
diff -r 770d168713cc -r cdd7d9a123f9 main.cpp
--- a/main.cpp	Thu Jan 06 20:42:44 2022 +0000
+++ b/main.cpp	Thu Jan 06 21:58:39 2022 +0000
@@ -37,7 +37,17 @@
       };
 
 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
- 
+ /* Test of the interup an operating the buzzer this kills the board 
+ void buzzme(){
+        Buzzer.play(200,120);
+            wait_ms(5);
+       Buzzer.play(200,120);;
+ }
+ */
+ void printme(){
+     
+     printf("A Pressed");
+     }
 int main() {
 //initialise Joystic
        joystick.init();
@@ -49,7 +59,7 @@
     buttonA.mode(PullDown);
     
 // It will return 0 by default and a 1 when pressed i.e. cause a rising edge
-    buttonA.rise(&buttonA_isr);
+  //  buttonA.rise(&buttonA_isr);
 
 
        
@@ -83,11 +93,13 @@
    Object1.te = 'A';
    Object1.dubs = 23;
  Object1.namestruct = "name";
+//buttonA.rise(&buzzme); Omitted due to error
+buttonA.rise(&printme);
     while(1) {
 //Tune(Buzzer,So6,8);
 //Stop_tunes(Buzzer);
 //Section of code to try to get the button press to be recorded
-bool button = buttonA.read();
+//bool button = buttonA.read();
 printf("%f\n", g_buttonA_flag );
 
        Buzzer.play(200,120);
@@ -144,12 +156,13 @@
         printf("Direction = %i\n",d);
         if (joystick.button_pressed() ) {
             printf("Button Pressed\n");  
+            wait(5);
         }
     
     }  
  }
  // Button A event-triggered interrupt
-void buttonA_isr()
-{
-    g_buttonA_flag = 1;   // set flag in ISR
-}
\ No newline at end of file
+//void buttonA_isr()
+//{
+  //  g_buttonA_flag = 1;   // set flag in ISR
+//}