mbed-os github

Dependencies:   ADS1015 Faulhaber HTU21D_mod MS5837_potless Sensor_Head_RevB_3 USBDevice_dfu Utilsdfu beep

Fork of ARNSRS_testDFU by POTLESS

Revision:
3:bc6d4222db12
Parent:
2:4a8bf1d53439
Child:
4:d84250f67dec
--- a/main.cpp	Sun Apr 30 23:29:19 2017 +0000
+++ b/main.cpp	Mon May 01 10:45:18 2017 +0000
@@ -13,11 +13,29 @@
 
 #include "mbed.h"
 #include <string>
+#include "MS5803_14BA.h"
+ 
+ 
+#ifdef TARGET_K64F
+ #define SPI_SCK     PTD1
+ #define SPI_MOSI    PTD2
+ #define SPI_MISO    PTD3
+ #define SPI_CS      PTD0
+ #define I2C_SDA     PTE25
+ #define I2C_SCL     PTE24
+#elif defined(TARGET_KL25Z)
+ #define SPI_SCK     PTD1
+ #define SPI_MOSI    PTD2
+ #define SPI_MISO    PTD3
+ #define SPI_CS      PTD0
+ #define I2C_SDA     PTE0
+ #define I2C_SCL     PTE1
+#endif
 
 Serial serialCozir (PA_11,PA_12,9600);
 Serial serialMonit (USBTX,USBRX,9600);
 char reponse[20]; // buffer 
-
+MS5803_14BA  ps(D14, D15, MS5803_ADDRC_L, D1_OSR_4096, D2_OSR_4096); // SDA, SCL, I2C_address (0x76 or 0x77 look at MS5803.h)
 
 ///////////////////////////////////
 // fonction de lecture capteur/////
@@ -134,12 +152,14 @@
     setup(); //initialisation capteur
 
     while (1){
-        serialMonit.printf("co2 COZIR par methode cozirSend = %5d\r\n"  ,cozirSend("Z")*10);    // on multiplie par 10 pour etre en ppm
-        serialMonit.printf("co2 COZIR par methode request   = %5d\r\n"  ,request('Z')*10);      // on multiplie par 10 pour etre en ppm  (méthode précédente)
+        serialMonit.printf("  co2 COZIR par methode cozirSend = %5d\r\n"  ,cozirSend("Z")*10);    // on multiplie par 10 pour etre en ppm
+        serialMonit.printf("  co2 COZIR par methode request   = %5d\r\n"  ,request('Z')*10);      // on multiplie par 10 pour etre en ppm  (méthode précédente)
         serialMonit.printf("  H COZIR par methode cozirSend = %5d\r\n"  ,cozirSend ("H"));      // à laisser comme ça pour transmettre en BLE mais à diviser par 10 à réception dans l'app android pour être en xx,x%
         serialMonit.printf("  H COZIR par methode request   = %5d\r\n"  ,request('H'));         // à laisser comme ça pour transmettre en BLE mais à diviser par 10 à réception dans l'app android pour être en xx,x%
         serialMonit.printf("  T COZIR par methode cozirSend = %5d\r\n"  ,cozirSend ("T")-1000); // à laisser comme ça pour envoi BLE et à diviser par 10 à réception dans l'app android pour etre en yy,y°C
         serialMonit.printf("  T COZIR par methode request   = %5d\r\n"  ,request('T')-1000);    // à laisser comme ça pour envoi BLE et à diviser par 10 à réception dans l'app android pour etre en yy,y°C
+        ps.convert();
+        serialMonit.printf("  Pression MS5803 = %4.1f\r\n", ps.pressure);
+        serialMonit.printf("  Température MS5803 = %4.1f\r\n", ps.temperature);
         wait (1);
-    } 
-}
\ No newline at end of file
+        }}