Dependencies:   ADXL345 DHT HMC5883L SerialGPS mbed

Files at this revision

API Documentation at this revision

Comitter:
fadi_lad
Date:
Sat Nov 05 21:01:22 2016 +0000
Child:
1:082c5ed435fa
Commit message:
V1

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	Sat Nov 05 21:01:22 2016 +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	Sat Nov 05 21:01:22 2016 +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	Sat Nov 05 21:01:22 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/gmatjuara/code/HMC5883L/#cad18db1e431
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SerialGPS.lib	Sat Nov 05 21:01:22 2016 +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	Sat Nov 05 21:01:22 2016 +0000
@@ -0,0 +1,93 @@
+#include "mbed.h"
+#include "DHT.h"
+#include "HMC5883L.h"
+#include "ADXL345.h"
+#include "SerialGPS.h"
+#define SDA      A4
+#define SCL      A5
+
+Serial pc(D8, PA_10);
+DHT sensor(D7, DHT11);
+HMC5883L compass(SDA, SCL); 
+ADXL345 accelerometer(D4, D5, D3, D2);
+SerialGPS gps(D1, D0);
+
+
+int main() {
+/////////////// Declaration des différentes variables utilisées //////////////// 
+float  temp,Humidity;
+float  xBoussole, yBoussole, zBoussole;
+int    Hour, Min, Sec, Pos, Sat;
+double Latitude, Longitude;
+/////////////////// configuration de la liaison serie ////////////////////////// 
+    pc.baud(9600); //speed(baud)
+    pc.format(8,Serial::None,1); //format(bits,SerialBase,stop_bits)
+/////////////////// configuration du cap température ///////////////////////////
+    int err;
+/////////////////// configuration de la Boussole /////////////////////////////// 
+    HMC5883L hmc5883l(SDA, SCL);
+/////////////////// configuration de l'accélérométre ///////////////////////////
+    int readings[3] = {0, 0, 0};
+    //Go into standby mode to configure the device.
+    accelerometer.setPowerControl(0x00);
+    //Full resolution, +/-16g, 4mg/LSB.
+    accelerometer.setDataFormatControl(0x0B);
+    //3.2kHz data rate.
+    accelerometer.setDataRate(ADXL345_3200HZ);
+    //Measurement mode.
+    accelerometer.setPowerControl(0x08);
+/////////////////// configuration GPS //////////////////////////////////////////
+SerialGPS::gps_gga_t *p;
+
+  while(1) { 
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////// aquisation du capteur de température/////////////////
+////////////////////////////////////////////////////////////////////////////////
+    err = sensor.readData();
+    //if (err==0){
+        temp=sensor.ReadTemperature(CELCIUS);
+        Humidity=sensor.ReadHumidity();
+        pc.printf("AT$SS= %x \r\n",(int)temp); 
+        pc.printf("AT$SS= %x \r\n",(int)Humidity);  
+   // }else
+   //     pc.printf("\r\Error DHT %i \n",err);
+       wait(5);    
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////// aquisation de la boussole ///////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+        xBoussole = hmc5883l.getMx();
+        yBoussole = hmc5883l.getMy();
+        zBoussole = hmc5883l.getMz();
+        pc.printf("AT$SS= %x \r\n",(int)xBoussole);  
+        pc.printf("AT$SS= %x \r\n",(int)yBoussole);  
+        pc.printf("AT$SS= %x \r\n",(int)zBoussole);  
+
+         wait(5);    
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////// aquisation de l'accélérométre ///////////////////////
+////////////////////////////////////////////////////////////////////////////////
+    accelerometer.getOutput(readings);
+  //  pc.printf("accelerometre %i, %i, %i\r\n", (int16_t)readings[0], (int16_t)readings[1], (int16_t)readings[2]);
+  //  pc.printf("AT$SS= %x \r\n",(int)readings[0]);  
+  //  pc.printf("AT$SS= %x \r\n",(int)readings[1]);  
+   // pc.printf("AT$SS= %x \r\n",(int)readings[2]);  
+
+    
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////// 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("AT$SS= %x \r\n", (int)Latitude);
+      pc.printf("AT$SS= %x \r\n", (int)Longitude);
+    wait(20);    
+ 
+  }
+}
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Nov 05 21:01:22 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9bcdf88f62b0
\ No newline at end of file