Early commits of my project

Dependencies:   mbed Gamepad N5110

Revision:
2:ba653520a140
Parent:
1:c80162894831
Child:
3:140cad440684
--- a/main.cpp	Mon Mar 11 19:29:50 2019 +0000
+++ b/main.cpp	Mon Mar 11 22:46:54 2019 +0000
@@ -7,16 +7,25 @@
 AnalogIn pot0(PTB2);
 DigitalIn joy_button(PTC16);
 BusOut front_leds(PTA1,PTA2,PTC2,PTC3,PTC4, PTD3);
+DigitalIn jump(PTC16);
+DigitalIn jumpa(PTB9);
+
+int x = 0;
+int y = 0;
+
 
 int main()
 {
     init();
-    
+    minerbitmap();
     
     
+   
+    
     while (1) {
+        contrast();
+        minerbitmap();
         
-        contrast();
     }
     
 }
@@ -38,4 +47,60 @@
     float con = pot0.read();
     lcd.setContrast(con);
     
-}
\ No newline at end of file
+}
+
+void minerbitmap()
+{
+    const int miner[13][5] =   {
+        0,0,0,1,1,
+        0,1,1,1,1,
+        0,1,0,1,0,
+        0,1,1,1,1,
+        0,1,1,1,0,
+        0,0,1,0,0,
+        1,1,1,1,1,
+        1,1,1,1,1,
+        1,1,1,1,1,
+        0,1,1,1,0,
+        0,1,0,1,0,
+        0,1,1,1,1,
+    };
+    
+    lcd.clear();
+    
+    
+    Direction d = joystick.get_direction();
+    printf("Direction = %i\n",d);
+    
+        if (d==3){   
+            lcd.clear();
+            x = x+1;
+            lcd.drawSprite(WIDTH/2 + x,HEIGHT/2 + y,13,5,(int *)miner);
+            lcd.refresh();
+            wait(0.25);
+        
+        }
+    
+        if (d == 7){   
+        
+            lcd.clear();
+            x = x-1;
+            lcd.drawSprite(WIDTH/2 + x,HEIGHT/2 + y,13,5,(int *)miner);
+            lcd.refresh();
+            wait(0.25);
+            }
+        if (jump == 1)
+        {   
+            lcd.clear();
+            
+            printf("Button Pressed\n");
+            y = y -5;
+            wait(0.1);
+            lcd.refresh();
+        }
+            else {
+                y = 0;
+            }    
+            lcd.drawSprite(WIDTH/2 + x,HEIGHT/2 + y,13,5,(int *)miner);
+            lcd.refresh();
+        }
\ No newline at end of file