Capteur température humidité OK

Dependencies:   HTU21D mbed

Files at this revision

API Documentation at this revision

Comitter:
Guillaume31
Date:
Mon Mar 30 16:45:43 2015 +0000
Commit message:
HTU21D-F (temp-hum) OK

Changed in this revision

HTU21D.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
diff -r 000000000000 -r a0c0a996bd03 HTU21D.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTU21D.lib	Mon Mar 30 16:45:43 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/hwing91/code/HTU21D/#db86ad1b4459
diff -r 000000000000 -r a0c0a996bd03 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Mar 30 16:45:43 2015 +0000
@@ -0,0 +1,49 @@
+#include "mbed.h"
+#include "HTU21D.h"
+
+#define SDA     D14 
+#define SCL     D15
+
+Serial pc(SERIAL_TX, SERIAL_RX);    // Port Serie Avec le PC
+
+// Digital I/O      Ex: DigitalOut Led1(D7);   // Port D7 : Sortie, nom=>Led1
+DigitalOut Led1(D7);             
+DigitalOut Led2(D8);
+DigitalOut Led3(D2);
+DigitalOut Led4(D3);
+
+DigitalIn Inter(D5);                // Port D5 : Entree, nom=>Inter
+
+//DigitalInOut SDA (D14);
+//DigitalInOut SCL (D15);
+//I2C tps(SDA_u, SCL_u);
+
+void initialisations () {
+    pc.printf("Initialisation\n\r");
+    //Inter.mode(PullUp); // Bouton Poussoir Normalement Ouvert a l'etat haut
+    
+    
+    pc.printf("Fin Initialisation\n\r");
+}
+
+int main() {
+    pc.printf("\n\r Lancement Programme\n\r");
+    initialisations ();
+    // Declaration Variables Locales
+    int cel = 0, far = 0, kel = 0, hum = 0;
+//    SDA.mode (PullUp);
+//    SCL.mode (PullUp);
+    
+    HTU21D temp(SDA, SCL);
+    pc.printf(" Temperatures : \n\r\t Celsius : %d \n\r\t Fahrenheit : %d \n\r\t Kelvin : %d \n\r Humidite : %d  %\n\n\r", cel, far, kel, hum);
+        
+    pc.printf("Debut While(1)\n\r");
+    while(1) {
+        cel = temp.sample_ctemp();
+        far = temp.sample_ftemp();
+        kel = temp.sample_ktemp();
+        hum = temp.sample_humid();
+        pc.printf(" Temperatures : \n\r\t Celsius : %d \n\r\t Fahrenheit : %d \n\r\t Kelvin : %d \n\r Humidite : %d  %\n\n\r", cel, far, kel, hum);
+        wait (5);
+    }
+}
diff -r 000000000000 -r a0c0a996bd03 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Mar 30 16:45:43 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7e07b6fb45cf
\ No newline at end of file