Test program for mbed app shield potentiometers
Fork of apps-shield-pots by
Revision 3:100dbea70564, committed 2014-02-06
- Comitter:
- chris
- Date:
- Thu Feb 06 15:42:52 2014 +0000
- Parent:
- 2:989f84939300
- Child:
- 4:f0eb984c583d
- Commit message:
- First check in
Changed in this revision
--- a/LM75B.lib Thu Jan 30 17:18:10 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 Thu Jan 30 17:18:10 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 Thu Jan 30 17:18:10 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ - - -// u-blox 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 -*/ - - -// ST Nucleo STM32F103RB - -#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 - -
--- a/main.cpp Thu Jan 30 17:18:10 2014 +0000 +++ b/main.cpp Thu Feb 06 15:42:52 2014 +0000 @@ -1,89 +1,19 @@ #include "mbed.h" -#include "arduino.h" #include "C12832.h" -#include "LM75B.h" -#include "MMA7660.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); +C12832_LCD lcd(D11, D13, D12, D7, D10); -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); - - - - +AnalogIn pot1 (A0); +AnalogIn pot2 (A1); int main() { - - int i=0; - - - 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()); - wait(1.0); - i++; - - } - - - - - - - /* - - - - while(1) { - -// === USING THE LCD ==== -// Note that the program will hang, even if we do not call any of the LCD functions -// Is it the cosntructor breaking things lcd.cls(); lcd.locate(0,3); - lcd.printf("Hello %d",i); - - -// === USING THE SDK Primitives === -// If we just use the SPI and DigitalOut, instead we can access them happily -// and the program runs -// a_d7 = !a_d7; -// a_d10 = !a_d10; -// a_d12 = !a_d12; -// myspi.write(i); - - - wait(0.2); - redled = !redled; // I have an red LED on my test board.. for sanity :) - i++; + lcd.printf("Pot 1 = %.2f", (float)pot1); + lcd.locate(0,14); + lcd.printf("Pot 2 = %.2f", (float)pot2); + wait(0.1); } -*/ - - - - }