Game For ECE 2035

Dependencies:   mbed wave_player 4DGL-uLCD-SE MMA8452

Revision:
6:c9695079521d
Parent:
1:399033d39feb
Child:
9:cbb9cfb1f6c5
--- a/hardware.cpp	Tue Oct 12 15:26:32 2021 +0000
+++ b/hardware.cpp	Fri Nov 19 22:03:25 2021 +0000
@@ -16,6 +16,7 @@
 DigitalIn button1(p21);                 // Pushbuttons (pin)
 DigitalIn button2(p22);
 DigitalIn button3(p23);
+DigitalIn button4(p24);
 AnalogOut DACout(p18);                  // Speaker (pin)
 PwmOut speaker(p26);
 wave_player waver(&DACout);
@@ -32,6 +33,8 @@
     button1.mode(PullUp); 
     button2.mode(PullUp);
     button3.mode(PullUp);
+    button4.mode(PullUp);
+    acc.activate();
     
     return ERROR_NONE;
 }
@@ -39,5 +42,18 @@
 GameInputs read_inputs() 
 {
     GameInputs in;
+    
+    //Accelerometer readings
+    acc.readXGravity(&in.ax);
+    acc.readYGravity(&in.ay);
+    acc.readZGravity(&in.az);
+    
+    
+    //button readings
+    in.b1 = button1.read();
+    in.b2 = button2.read();
+    in.b3 = button3.read();
+    in.b4 = button3.read();
+    
     return in;
 }