![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ATT_SMS_System for home security system
Dependencies: FXOS8700CQ MODSERIAL mbed-rtos mbed
Fork of ATT_Cellular_IOT_Button by
Diff: main.cpp
- Revision:
- 4:f83bedd9cab4
- Parent:
- 3:26b3cc155f39
- Child:
- 5:3417b6a84ee3
diff -r 26b3cc155f39 -r f83bedd9cab4 main.cpp --- a/main.cpp Sun Jul 10 09:12:33 2016 +0000 +++ b/main.cpp Mon Jul 11 06:53:41 2016 +0000 @@ -5,7 +5,7 @@ #include "HTS221.h" #include "config_me.h" #include "wnc_control.h" - +#include "sensors.h" // comment out the following line if color is not supported on the terminal #define USE_COLOR @@ -237,17 +237,6 @@ //******************************************************************************************************************************************** //* Create string that can be sent to flow as an HTTP get //******************************************************************************************************************************************** -static K64F_Sensors_t SENSOR_DATA = -{ - .Temperature = "0", - .Humidity = "0", - .AccelX = "0", - .AccelY = "0", - .AccelZ = "0", - .AmbientLight = "0", - .UVindex = "0", - .Proximity = "0" -}; static Flow_datapoint_t FLOW_DATAPOINT = { .URL_start = FLOW_CALLBACK_URL_START, @@ -310,6 +299,7 @@ // Resolve URL to IP address to connect to resolve_mdm(); + sensors_init(); //Create a 1ms timer tick function: OneMsTicker.attach(OneMsFunction, 0.001f) ; iTimer1Interval_ms = 5000; //5 seconds @@ -321,14 +311,12 @@ bTimerExpiredFlag = false; sprintf(SENSOR_DATA.Temperature, "%0.2f", CTOF(hts221.readTemperature())); sprintf(SENSOR_DATA.Humidity, "%02d", hts221.readHumidity()); - + read_sensors(); //read available external sensors from a PMOD and the on-board motion sensor sockopen_mdm(); - char modem_string[512]; GenerateModemString(&modem_string[0]); printf(DEF "Sending to modem : %s\n", modem_string); //sockwrite_mdm("GET /f653d97537235/a31c2684a02c/d35e42196968fd6/in/flow/climate?deviceID=e5ee19804bd500c8fe69a809342384c2&temp=41.0&humidity=87.33 HTTP/1.1 Host: run-east.att.io:80 Accept: */*\r\n\r\n"); - sockwrite_mdm(modem_string); sockread_mdm(&MySocketData, 1024, 20); sockclose_mdm();