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:
Wed Jan 01 08:42:34 2014 +0000
Child:
1:c409f3abab09
Commit message:
Added in a header to switch between Arch and KL25Z pin mapping

Changed in this revision

C12832_lcd.lib Show annotated file Show diff for this revision Revisions of this file
LM75B.lib Show annotated file Show diff for this revision Revisions of this file
MMA7660.lib Show annotated file Show diff for this revision Revisions of this file
arduino.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832_lcd.lib	Wed Jan 01 08:42:34 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/chris/code/C12832_lcd_fork/#8a9cad03124b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LM75B.lib	Wed Jan 01 08:42:34 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/neilt6/code/LM75B/#fc27dc535ea9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA7660.lib	Wed Jan 01 08:42:34 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/MMA7660/#a8e20db7901e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arduino.h	Wed Jan 01 08:42:34 2014 +0000
@@ -0,0 +1,56 @@
+#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 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jan 01 08:42:34 2014 +0000
@@ -0,0 +1,93 @@
+#include "mbed.h"
+
+#define PLATFORM_ARCH
+#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);
+
+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);
+
+
+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) {
+        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++;
+
+        }
+
+    */
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jan 01 08:42:34 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file