projet capteur connecté ST/SE
Dependencies: HP206C mbed HMC5883L DHT DS1820
Revision 58:010c2047feec, committed 2018-10-01
- Comitter:
- Fayge
- Date:
- Mon Oct 01 08:02:20 2018 +0000
- Parent:
- 34:8642124e554c
- Parent:
- 33:2a6476c33e74
- Commit message:
- merge
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DS1820.lib Mon Oct 01 08:02:20 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/Sissors/code/DS1820/#236eb8f8e73a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/H_sol.cpp Mon Oct 01 08:02:20 2018 +0000 @@ -0,0 +1,8 @@ +//florent +#include "H_sol.h" +#include "mbed.h" + +float getSoilHumidity(AnalogIn sensor) +{ + return sensor.read()/((float)3.0); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/H_sol.h Mon Oct 01 08:02:20 2018 +0000 @@ -0,0 +1,12 @@ +#ifndef H_SOL +#define H_SOL + +#include "mbed.h" + +#define LOW_H 160 +#define HIGH_H 520 + +//AnalogIn moisture(A0);//( A0 -> A7 ) +float getSoilHumidity(AnalogIn sensor); + +#endif \ No newline at end of file
--- a/T_H_air.cpp Mon Oct 01 07:48:57 2018 +0000 +++ b/T_H_air.cpp Mon Oct 01 08:02:20 2018 +0000 @@ -0,0 +1,13 @@ +#include "T_H_air.h" + +DHT sensor(PinName, DHTtype); + +float airHumidity(){ + int err = 0; + + err = sensor.readData(); + if( !err ){ + return sensor.ReadHumidity() ; + } + return EXIT_FAILURE ; + } \ No newline at end of file
--- a/T_H_air.h Mon Oct 01 07:48:57 2018 +0000 +++ b/T_H_air.h Mon Oct 01 08:02:20 2018 +0000 @@ -0,0 +1,8 @@ +#include "mbed.h" +#include "DHT.cpp" + +//Configuration +#define PinName p23 +#define DHTtype DHT22 + +float airHumidity( void ); \ No newline at end of file
--- a/communication.cpp Mon Oct 01 07:48:57 2018 +0000 +++ b/communication.cpp Mon Oct 01 08:02:20 2018 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" +#include "communication.h" + +Serial wisol(SERIAL_PORT); + +void initCommunication() { + wisol.baud(9600); +} + +void sendMessage(char* data) { + wisol.printf("AT$SF=%s", data); +} + +char* genMessage(float h_sol, float h_air) { + static char m[12]; + return m; +} \ No newline at end of file
--- a/communication.h Mon Oct 01 07:48:57 2018 +0000 +++ b/communication.h Mon Oct 01 08:02:20 2018 +0000 @@ -0,0 +1,10 @@ +#ifndef __COMMUNICATION__ +#define __COMMUNICATION__ + +#define SERIAL_PORT D1, D0 + +void initCommunication(); +void sendMessage(char* data); +char* genMessage(float h_sol, float h_air); + +#endif \ No newline at end of file
--- a/main.cpp Mon Oct 01 07:48:57 2018 +0000 +++ b/main.cpp Mon Oct 01 08:02:20 2018 +0000 @@ -4,9 +4,16 @@ int main() { while(1) { - myled = 1; // LED is ON - wait(0.2); // 200 ms - myled = 0; // LED is OFF - wait(1.0); // 1 sec + /* + read T&H air + read T sol + read H sol + read Pressure + read Magnetic + + m = genMessage(T_air, H_air, T_sol, H_sol, Pressure, Mag) + sendMessage(m) + */ + wait(60*15); } }