![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
heelo
Dependencies: ADXL345 DHT HMC5883L_12 SerialGPS mbed
Revision 0:ae92213ab8f4, committed 2017-02-05
- Comitter:
- fadi_lad
- Date:
- Sun Feb 05 23:08:45 2017 +0000
- Commit message:
- hello_world
Changed in this revision
diff -r 000000000000 -r ae92213ab8f4 ADXL345.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ADXL345.lib Sun Feb 05 23:08:45 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/aberk/code/ADXL345/#bd8f0f20f433
diff -r 000000000000 -r ae92213ab8f4 DHT.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DHT.lib Sun Feb 05 23:08:45 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/Wimpie/code/DHT/#9b5b3200688f
diff -r 000000000000 -r ae92213ab8f4 HMC5883L.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HMC5883L.lib Sun Feb 05 23:08:45 2017 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/fadi_lad/code/HMC5883L_12/#17f3539e91b0
diff -r 000000000000 -r ae92213ab8f4 SerialGPS.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SerialGPS.lib Sun Feb 05 23:08:45 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/shintamainjp/code/SerialGPS/#a5b887e09aa4
diff -r 000000000000 -r ae92213ab8f4 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Feb 05 23:08:45 2017 +0000 @@ -0,0 +1,115 @@ +#include "mbed.h" +#include "HMC5883L.h" +#include "DHT.h" +#include "ADXL345.h" +#include "SerialGPS.h" + +//SerialGPS gps(D1, D0); +DHT sensor(D6, DHT22); +Serial pc(A7, NC); // tx, rx +Serial rfid(NC, D4); //tx, rx +//DigitalIn btn(PC_13); + +InterruptIn button_RFID(PA_9); +InterruptIn button_SOS(PB_0); + +DigitalOut led(LED2); + +void ReadRFID_CALLBACK(); +void SOS_CALLBACK() ; + + // 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 SOSEtat; +float temp,Humidity; +int RFID=0; + + + +int main() +{ + + // variable DHT11 /////////////////////////// + int err; + + // configuration du BTN RFID + button_RFID.mode(PullUp); + button_RFID.fall(&ReadRFID_CALLBACK); // attach the address of the flip function to the rising edge + led = 0; + // configuration du BTN SOS + button_SOS.mode(PullUp); + button_SOS.fall(&SOS_CALLBACK); // attach the address of the flip function to the rising edge + led = 0; + + while(1) + { + RFID=0; + SOSEtat=0; +//////////////////////////////////////////////////////////////////////////////// +////////////////////////// aquisation de la boussole /////////////////////////// +//////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////// +////////////////////////// aquisation du capteur de température///////////////// +//////////////////////////////////////////////////////////////////////////////// + err = sensor.readData(); + if (err==0){ + temp=sensor.ReadTemperature(CELCIUS); + Humidity=sensor.ReadHumidity(); + SOSEtat=0; + // pc.printf("AT$SS=%x%x%x%x0000\r\n",(int)temp,(int)Humidity,SOSEtat,RFID); + } + //pc.printf("*********************\r\n"); + + + //pc.printf("AT$SS=%x%x0000\r\n",SOSEtat,RFID); + + +//////////////////////////////////////////////////////////////////////////////// +////////////////////////// Sigfox ////////////::::::::::::::://///////// +//////////////////////////////////////////////////////////////////////////////// + // pc.printf("AT$SS=%x %x \r\n",(int)sensor.ReadTemperature(CELCIUS),(int)sensor.ReadHumidity(),(int)RFID); + // pc.printf("AT$SS= %x %x \r\n",(int)sensor.ReadTemperature(CELCIUS),(int)sensor.ReadHumidity()); + + wait(3); + } +} + +//////////////////////////////////////////////////////////////////////////////// +////////////////////////// aquisation RFID ///////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +void ReadRFID_CALLBACK() { + // configuration RFID + int i; + int RFID_read[15]; + pc.printf("RFID_read1 : \r\n"); + for(i=0;i<5;i++) + RFID_read[i]=rfid.getc(); + for(i=0;i<5;i++) + RFID=RFID+RFID_read[i]; + pc.printf("AT$SS=%x%x0000\r\n",SOSEtat,RFID); + wait(3); + +} + +//////////////////////////////////////////////////////////////////////////////// +////////////////////////// aquisation GPS_SOS ////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +void SOS_CALLBACK() { + //pc.printf("AT$SS=SOS \r\n"); + SOSEtat=1; + pc.printf("AT$SS=%x%x0000\r\n",SOSEtat,RFID); + + +} \ No newline at end of file
diff -r 000000000000 -r ae92213ab8f4 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Feb 05 23:08:45 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/ad3be0349dc5 \ No newline at end of file