by L.F

Dependencies:   ADXL345 DHT HMC5883L SerialGPS mbed

Files at this revision

API Documentation at this revision

Comitter:
fadi_lad
Date:
Tue Jan 03 09:25:27 2017 +0000
Child:
1:5e89c2fd0d7f
Commit message:
V 1.1

Changed in this revision

ADXL345.lib Show annotated file Show diff for this revision Revisions of this file
DHT.lib Show annotated file Show diff for this revision Revisions of this file
HMC5883L.lib Show annotated file Show diff for this revision Revisions of this file
SerialGPS.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ADXL345.lib	Tue Jan 03 09:25:27 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/aberk/code/ADXL345/#bd8f0f20f433
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DHT.lib	Tue Jan 03 09:25:27 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/Wimpie/code/DHT/#9b5b3200688f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HMC5883L.lib	Tue Jan 03 09:25:27 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/gmatjuara/code/HMC5883L/#b39752f2d354
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SerialGPS.lib	Tue Jan 03 09:25:27 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/shintamainjp/code/SerialGPS/#a5b887e09aa4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jan 03 09:25:27 2017 +0000
@@ -0,0 +1,81 @@
+#include "mbed.h"
+#include "HMC5883L.h"
+#include "DHT.h"
+#include "ADXL345.h"
+#include "SerialGPS.h"
+
+SerialGPS gps(D1, D0);
+DHT sensor(D7, DHT22);
+Serial pc(D8, PA_10); // tx, rx 
+ // Utility Boussole HMC5883L
+#ifndef M_PI
+#define M_PI 3.1415926535897932384626433832795
+#endif
+#define PI2         (2*M_PI)
+#define RAD_TO_DEG  (180.0/M_PI)
+#define DEG_TO_RAD  (M_PI/180.0)
+#define  DECLINATION_ANGLE -0.02123
+#define SDA      A4
+#define SCL      A5
+ 
+int main()
+{   
+    // varible Boussole HMC5883L  
+    double heading;  
+    float x, y, z;
+    HMC5883L hmc5883l(SDA, SCL);
+    // variable DHT11 ///////////////////////////
+    float  temp,Humidity;
+    int err;
+    // configuration GPS //////////////////////////////////////////
+    SerialGPS::gps_gga_t *p;
+    int    Hour, Min, Sec, Pos, Sat;
+    double Latitude, Longitude;
+
+    while(1) 
+    { 
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////// aquisation de la boussole ///////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+        x = hmc5883l.getMx();
+        y = hmc5883l.getMy();
+        z = hmc5883l.getMz();     
+        pc.printf("x, y, z: %f, %f,%f \r\n",x,y,z);
+        heading = atan2(static_cast<double>(y), static_cast<double>(x)); // heading = arctan(Y/X)
+        heading += DECLINATION_ANGLE; 
+        if(heading < 0.0) // fix sign
+            heading += PI2;
+        if(heading > PI2) // fix overflow
+            heading -= PI2; 
+        pc.printf("heading:%f\r\n",heading);
+        pc.printf("*********************\r\n");           
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////// aquisation du capteur de température/////////////////
+////////////////////////////////////////////////////////////////////////////////
+        err = sensor.readData();
+        if (err==0){
+            temp=sensor.ReadTemperature(CELCIUS);
+            Humidity=sensor.ReadHumidity();
+            pc.printf(" temp / hem =%f, %f\r\n",temp,Humidity);  
+       }
+        pc.printf("*********************\r\n");           
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////// aquisation gps ////////////:::::::::::::::///////////
+////////////////////////////////////////////////////////////////////////////////
+         gps.processing();
+         Hour= p->hour;
+         Min = p->min;
+         Sec = p->sec;
+         Pos = p->position_fix;
+         Sat = p->satellites_used;
+         Latitude = p->latitude;
+         Longitude= p->longitude;  
+         pc.printf("gps= %d, %d \r\n",Latitude,Longitude);
+         pc.printf("hour= %i \r\n",Hour);
+         pc.printf("min= %i \r\n",Sec);
+         pc.printf("position_fix= %i \r\n",Pos);
+         pc.printf("*********************\r\n");           
+    
+        wait(10); 
+    }  
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jan 03 09:25:27 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9baf128c2fab
\ No newline at end of file