Example using sensors from the mbed apps board or shield

Dependencies:   C027 LM75B MMA7660 mbed

Files at this revision

API Documentation at this revision

Comitter:
sam_grove
Date:
Mon Feb 03 05:10:09 2014 +0000
Parent:
1:ac55ff7b1a7d
Child:
3:682a0098a325
Commit message:
Initial commit

Changed in this revision

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
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LM75B.lib	Mon Feb 03 05:10:09 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	Mon Feb 03 05:10:09 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/MMA7660/#a8e20db7901e
--- a/main.cpp	Mon Feb 03 05:00:28 2014 +0000
+++ b/main.cpp	Mon Feb 03 05:10:09 2014 +0000
@@ -1,16 +1,20 @@
 #include "mbed.h"
 #include "C027.h"
 #include "C12832_lcd.h"
+#include "MMA7660.h"
+#include "LM75B.h"
 
-//#define MBED_APPS_SHIELD
-#define MBED_APPS_BOARD
+#define MBED_APPS_SHIELD
+//#define MBED_APPS_BOARD
 
 DigitalOut myled(LED1);
 
 #if defined(MBED_APPS_SHIELD)
-  PwmOut spkr(D6);
+  MMA7660 mma(SDA, SCL);
+  LM75B temperature_sensor(SDA, SCL);
 #elif defined(MBED_APPS_BOARD)
-  PwmOut spkr(p26);
+  MMA7660 mma(p28, p27);
+  LM75B temperature_sensor(p28, p27);
 #else
 #error application board not defined
 #endif
@@ -18,15 +22,11 @@
 int main()
 {
     while(1) {
-        for(int j=0; j<3; j++) {
-            for (float i=2000.0; i<4000.0; i+=100) {
-                spkr.period(1.0/i);
-                spkr=0.5;
-                wait(0.1);
-                myled = !myled;
-            }
-            spkr=0.0;
-            wait(2.0f);
-        }
+        
+        float temp = temperature_sensor;
+        float x = mma.x();
+        float y = mma.y();
+        float z = mma.z();
+        wait(1.0f);
     }
 }