Test program for mbed app shield joystick

Dependencies:   mbed

Fork of mbed-apps-shield by Chris Styles

Files at this revision

API Documentation at this revision

Comitter:
chris
Date:
Thu Feb 06 15:37:09 2014 +0000
Parent:
1:c409f3abab09
Child:
3:ff19aac2a59c
Commit message:
First check in

Changed in this revision

C12832_lcd.lib Show diff for this revision Revisions of this file
LM75B.lib Show diff for this revision Revisions of this file
MMA7660.lib Show diff for this revision Revisions of this file
arduino.h Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/C12832_lcd.lib	Fri Jan 03 22:48:18 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/chris/code/C12832_lcd_fork/#8a9cad03124b
--- a/LM75B.lib	Fri Jan 03 22:48:18 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/neilt6/code/LM75B/#fc27dc535ea9
--- a/MMA7660.lib	Fri Jan 03 22:48:18 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/Sissors/code/MMA7660/#a8e20db7901e
--- a/arduino.h	Fri Jan 03 22:48:18 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-#ifdef PLATFORM_ARCH
-    #define ARD_A0  P0_11
-    #define ARD_A1  P0_12
-    #define ARD_A2  P0_13
-    #define ARD_A3  P0_14
-    #define ARD_A4  P0_16
-    #define ARD_A5  P0_22
-
-    #define ARD_D0  P0_18
-    #define ARD_D1  P0_19
-    #define ARD_D2  P0_17
-    #define ARD_D3  P1_17
-    #define ARD_D4  P1_18
-    #define ARD_D5  P1_24
-    #define ARD_D6  P1_25
-    #define ARD_D7  P1_5
-
-    #define ARD_D8  P1_26
-    #define ARD_D9  P1_27
-    #define ARD_D10 P0_2
-    #define ARD_D11 P1_29
-    #define ARD_D12 P0_8
-    #define ARD_D13 P0_9
-    
-    #define ARD_SDA P0_5
-    #define ARD_SCL P0_4
-#endif 
-
-
-#ifdef PLATFORM_KL25Z
-    #define ARD_A0  PTB0
-    #define ARD_A1  PTB1
-    #define ARD_A2  PTB2
-    #define ARD_A3  PTB3
-    #define ARD_A4  PTC2
-    #define ARD_A5  PTC1
-
-    #define ARD_D0  PTA1
-    #define ARD_D1  PTA2
-    #define ARD_D2  PTD4
-    #define ARD_D3  PTA12
-    #define ARD_D4  PTA4
-    #define ARD_D5  PTA5
-    #define ARD_D6  PTC8
-    #define ARD_D7  PTC9
-
-    #define ARD_D8  PTA13
-    #define ARD_D9  PTD5
-    #define ARD_D10 PTD0
-    #define ARD_D11 PTD2
-    #define ARD_D12 PTD3
-    #define ARD_D13 PTD1
-    
-    #define ARD_SDA PTE0
-    #define ARD_SCL PTE1
-#endif 
-
-
-
-#ifdef PLATFORM_C027
-    #define ARD_A0  P0_23
-    #define ARD_A1  P0_24
-    #define ARD_A2  P0_25
-    #define ARD_A3  P0_26
-    #define ARD_A4  P0_30
-    #define ARD_A5  P1_31
-
-    #define ARD_D0  P4_29
-    #define ARD_D1  P4_28
-    #define ARD_D2  P2_13
-    #define ARD_D3  P2_0
-    #define ARD_D4  P2_12
-    #define ARD_D5  P2_1
-    #define ARD_D6  P2_2
-    #define ARD_D7  P2_11
-
-    #define ARD_D8  P2_4
-    #define ARD_D9  P2_3
-    #define ARD_D10 P1_21
-    #define ARD_D11 P1_24
-    #define ARD_D12 P1_23
-    #define ARD_D13 P1_20
-    
-    #define ARD_SDA P0_0
-    #define ARD_SCL P0_1
-#endif 
-
-
-
--- a/main.cpp	Fri Jan 03 22:48:18 2014 +0000
+++ b/main.cpp	Thu Feb 06 15:37:09 2014 +0000
@@ -1,93 +1,24 @@
 #include "mbed.h"
 
-#define PLATFORM_C027
-#include "arduino.h"
-
-#include "LM75B.h"
-#include "MMA7660.h"
-#include "C12832_lcd.h"
-
-C12832_LCD lcd(ARD_D11,ARD_D13, ARD_D12, ARD_D7, ARD_D10);
-
-DigitalOut redled(ARD_D5);
-DigitalOut blueled(ARD_D8);
-DigitalOut greenled(ARD_D9);
+DigitalOut red_led(D5);
+DigitalOut blue_led(D8);
+DigitalOut green_led(D9);
 
-LM75B sensor(ARD_SDA,ARD_SCL);
-MMA7660 MMA(ARD_SDA,ARD_SCL);
-
-//DigitalOut spk(ARD_D6);
-
-AnalogIn pot1 (ARD_A0);
-AnalogIn pot2 (ARD_A1);
-
-DigitalIn up(ARD_A2);
-DigitalIn down(ARD_A3);
-DigitalIn left(ARD_A4);
-AnalogIn right(ARD_A5);
-DigitalIn center(ARD_D4);
+DigitalIn up(A2);
+DigitalIn down(A3);
+DigitalIn left(A4);
+AnalogIn right(A5);
+DigitalIn fire(D4);
 
 
 int main()
 {
 
-    redled = 1;
-    blueled =1;
-    greenled=1;
-    int i=0;
-
-while (1) {
-    lcd.cls();
-    lcd.locate(0,3);
-    lcd.printf("woot! %d!",i);
-    i++;
-    redled = !redled;
-    wait(1.0);
+    while (1) {
+        red_led =  !up && ! fire;
+        blue_led = !down;
+        green_led= !left && !right;
+    }
 }
 
 
-
-/*
-    while (1) {
-        redled =  !up && ! center;
-        blueled = !down;
-        greenled= !left && !right;
-    }
-*/
-
-    /*
-            while (1) {
-                redled = 1;
-                wait(pot2.read());
-                redled = 0;
-                wait(pot2.read());
-
-            }
-
-
-        while(1) {
-            lcd.cls();
-            lcd.locate(0,3);
-            lcd.printf("%.3f  %.3f %.3f", pot1.read(),pot2.read(), right.read());
-            wait(0.2);
-        }
-
-
-        while(1) {
-            lcd.cls();
-            lcd.locate(0,3);
-            lcd.printf("Temp = %.3f", (float)sensor);
-            lcd.locate(0,14);
-            lcd.printf("x=%.2f y=%.2f z=%.2f",MMA.x(), MMA.y(), MMA.z());
-            blueled = !blueled;
-            greenled = !greenled;
-            wait(1.0);
-            i++;
-
-        }
-
-    */
-
-}
-
-