Programme complet

Dependencies:   DHT11 HMC5883L

Files at this revision

API Documentation at this revision

Comitter:
wallsow
Date:
Fri Jan 06 13:31:35 2017 +0000
Child:
1:c82fe7774fde
Commit message:
Programme complet

Changed in this revision

.gitignore Show annotated file Show diff for this revision Revisions of this file
DHT11.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
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitignore	Fri Jan 06 13:31:35 2017 +0000
@@ -0,0 +1,4 @@
+.build
+.mbed
+projectfiles
+*.py*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DHT11.lib	Fri Jan 06 13:31:35 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/s_inoue_mbed/code/DHT11/#e91c151d1798
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HMC5883L.lib	Fri Jan 06 13:31:35 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/tylerjw/code/HMC5883L/#bc4e1201e092
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jan 06 13:31:35 2017 +0000
@@ -0,0 +1,59 @@
+#include "mbed.h"
+#include "DHT11.h"
+#include "HMC5883L.h"
+
+
+
+//-------Pin Connection----///
+DHT11 sensor(D4);//D4=jeremy
+HMC5883L bouss(PB_9, PB_8); // HMC5883L(PinName sda, PinName scl) PB_8 + PB_9
+AnalogIn inputx(PC_0); // input PC_0 for X axis
+AnalogIn inputy(PC_1); // input PC_1 for Y axis
+AnalogIn inputz(PB_1); // input PB_1 for Z axis
+//---------------
+
+int main()
+{
+    //serial config
+    Serial serial(PA_0,PA_1);  /*PA_0=A0=TX PA_1=A0=RX*/
+    serial.baud(9600);
+    serial.format(8,SerialBase::None,1);
+    serial.printf("\r\nDHT Test program");
+    serial.printf("\r\n****************\r\n");
+    //char tmp[30];//="AT$SS=00 12 FF 42 \r\n";//$SS 
+    float x=0,y=0,z=0; // variables for x,y,z axes
+    
+    
+    while(1){
+
+//----------------DHT/start------------------//
+    int s,T,H;
+    s = sensor.readData();
+    T=sensor.readTemperature();
+    H=sensor.readHumidity();
+    if (s != DHT11::OK) {
+        serial.printf("Error!\r\n");
+    }
+    else {
+        serial.printf("AT$SS=%x%x\r\n", T,H);
+    }
+//----------------DHT/end------------------//
+
+//----------------Boussole/start------------------//
+bouss.init();
+double test=5;
+test= bouss.getHeadingXYDeg(); 
+serial.printf("\r\n%2f\r\n",test);
+//----------------Boussole/end------------------//
+
+//----------------Accelerometre/start------------------//
+        x = inputx;
+        y = inputy;
+        z = inputz;
+        serial.printf("X:%f,Y: %f,Z: %f *\r\n",x,y,z); 
+//----------------Accelerometre/end------------------//
+    
+    
+    wait(60);
+}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Fri Jan 06 13:31:35 2017 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#0789928ee7f2db08a419fa4a032fffd9bd477aa7