Code for driving 9x OLED displays and reding from an HX711 load cell aplifier.

Dependencies:   Adafruit_GFX SPI_TFT_ILI9341 TFT_fonts hx711 mbed

Revision:
5:1f0fc1bc6850
Parent:
4:89541d91cef1
Child:
6:f0ee0b0bc480
--- a/main.cpp	Mon Mar 09 00:01:09 2015 +0000
+++ b/main.cpp	Tue Mar 31 13:57:31 2015 +0000
@@ -24,6 +24,12 @@
 DigitalOut led1(LED1);
 DigitalOut led2(LED2);
 
+DigitalIn sw_left(PTC8);
+DigitalIn sw_right(PTC9);
+DigitalIn sw_up(PTC0);
+DigitalIn sw_down(PTC7);
+DigitalIn sw_fire(PTC5);
+
 BusOut MuxPortOut(PTB11, PTB2, PTB10, PTB3);
 
 DigitalOut LCD_LED(PTC3); // the TFT display has a backlight switch
@@ -119,6 +125,13 @@
  
 int main()
 {
+    // Set our imput buttons to pull-up mode
+    sw_left.mode(PullUp);
+    sw_right.mode(PullUp);
+    sw_up.mode(PullUp);
+    sw_down.mode(PullUp);
+    sw_fire.mode(PullUp);
+    
 // ILI9341 Test Routine
     int i;
     LCD_LED = 1;  // backlight on
@@ -272,7 +285,13 @@
         led2 = 1;
         x++;
         y--;
-        a++;
+        if ( sw_up == 0 ){
+            a++;
+        } 
+        if ( sw_down == 0 ){
+            a--;
+        } 
+        
         b--;
         TFT.locate(10,80);
         TFT.foreground(65535);