Testé pour projet BTS SN

Dependencies:   MPL115A1 mbed

Fork of MPL115A1_HelloWorld by Christian Dupaty

Files at this revision

API Documentation at this revision

Comitter:
cdupaty
Date:
Sat Apr 30 17:07:31 2016 +0000
Parent:
0:b03929952ce3
Commit message:
Test? pour projet BTS SN

Changed in this revision

MPL115A1.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
mpl115a1.lib Show diff for this revision Revisions of this file
diff -r b03929952ce3 -r 3bdc0f29c3ae MPL115A1.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MPL115A1.lib	Sat Apr 30 17:07:31 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mk/code/MPL115A1/#b2adf1b62898
diff -r b03929952ce3 -r 3bdc0f29c3ae main.cpp
--- a/main.cpp	Thu Nov 07 14:12:03 2013 +0000
+++ b/main.cpp	Sat Apr 30 17:07:31 2016 +0000
@@ -1,23 +1,15 @@
-#include "mbed.h"
-#include "mpl115a1.h"
-Serial pc(USBTX,USBRX);
-int main() {
-// Chip must be deselected
-    cs = 1;
- 
-    // Setup the spi for 8 bit data, high steady state clock,
-    // second edge capture, with a 8MHz clock rate
-    spi.format(8,0);
-    spi.frequency(8000000);
-//Chip selscted
-cs=0;
-    while(1) {
-        float pressure_pKa = 0;
-        sdn=1;
-        wait(0.02);
-        pressure_pKa = calculatePressurekPa();
-        pc.printf("Pressure=%d",pressure_pKa);
-        sdn=0;
-        wait(5);
-    }
-}
+#include "mbed.h"
+ #include "MPL115A1.h"
+ 
+SPI spi(SPI_MOSI,SPI_MISO,SPI_SCK);
+MPL115A1 bar(spi, SPI_CS);
+ 
+Serial pc(USBTX, USBRX);
+ 
+int main() {
+    while(1) {
+        wait(10);
+        pc.printf("Pressure is %f\n", bar.readPressure());  // en kPa
+        pc.printf("Temperature is %f\n", bar.readTemperature()); // en degC... temperature non compense
+    }
+}
\ No newline at end of file
diff -r b03929952ce3 -r 3bdc0f29c3ae mbed.bld
--- a/mbed.bld	Thu Nov 07 14:12:03 2013 +0000
+++ b/mbed.bld	Sat Apr 30 17:07:31 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/c0f6e94411f5
\ No newline at end of file
diff -r b03929952ce3 -r 3bdc0f29c3ae mpl115a1.lib
--- a/mpl115a1.lib	Thu Nov 07 14:12:03 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/Parkz/code/mpl115a1/#89572af84e82