This program connects to a few sensors via I2C and sends the data collected to a WNC Cellular Module which is located on an Avnet WNC-Shield card.

Dependencies:   FXOS8700CQ MODSERIAL mbed

/media/uploads/kevinkeryk/avnet_logo_tagline_rgb.png

Avnet Cellular IoT Instructions

  • One problematic area is setting the MY_SERVER_URL. When you copy the URL from the flow, you must make sure the MY_SERVER_URL is also set to the appropriate server. It can be either "run-east.att.io" or "run-west.att.io".

Useful Links

Adding Additional Sensors

The FLOW_DEVICE_NAME field must contain the name of the instance of the Virtual Starter Kit in FLOW you will be communicating with. Usually this is "vstarterkit001", but if you have problems communicating you can verify this is correct. Note: This device will not be created until you click the “Initialize” input on the Virtual Device tab of the Starter Kit project in FLOW. At that point, it becomes available in M2X and you can see it as the DEVICE SERIAL field under Devices as in the image below. /media/uploads/JMF/vstarterkit.png

Sensors: When executing, the FRDM-K64F board uploads sensor measurements to AT&T’s Flow environment every 5 seconds, using the Cellular shield board. You can adjust how often you want to do this by editing the SENSOR_UPDATE_INTERVAL_MS value in the header file.

Temperature and humidity: By default, the board reports readings from the HTS221 temperature and humidity sensor. These two values are sent to the HTTP IN /climate port in FLOW with field names “temp” and “humidity”. Temperature is in degrees Fahrenheit and humidity is a %. This default assignment is: iSensorsToReport = TEMP_HUMIDITY_ONLY;

Accelerometer: If you want to expand and use the onboard motion sensor, you can also send 3-axis accelerometer information from the board as “accelX”, “accelY”, and “accelZ”. This is useful if you want to know the stationary position of the board with regards to gravity, or whether it is in motion. These readings are in g’s. To send these values, change the assignment to: iSensorsToReport = TEMP_HUMIDITY_ACCELEROMETER;

PMOD Sensors: If you have a Silicon Labs sensor module that can plug into the PMOD connector on the Cellular shield, you are able to measure proximity, UV light, ambient visible and infrared light from the Si1145 sensor. This PMOD also has a temperature and humidity sensor, but in this case it is redundant. When enabled, the fields “proximity”, “light_uv”, “light_vis” and “light_ir” are also sent. To enable all these sensors, change the assignment to: iSensorsToReport = TEMP_HUMIDITY_ACCELEROMETER_PMODSENSORS;

Connecting the PMOD sensors: Because the pinouts do not align, the SiLabs PMOD sensor board cannot be plugged into the J10 PMOD receptacle on the shield directly. The following wiring instructions must be followed:

SignalJ10ShieldPMOD Color in the image below
VCCPin 6Pin 6Red
GNDPin 5Pin 5Black
SDAPin4Pin 3Green
SCLPin3Pin 2Yellow

/media/uploads/JMF/xyz.jpg

AT&T M2X and FLOW Instructions

M2X & FLOW Instructions

Link to AT&T M2X

M2X

Link to AT&T Flow

FLOW

Avnet WNC-Shield Information

Getting Started with the Avnet WNC-Shield Software

  • This project uses Revision 119 of the MBED library because of I2C implementation differences with the tip (Revision 121).
  • This project uses Revision 4 of the FXOS8700CQ library for sensors.

Easily Modifiable Parameters

Inside the mbed Avnet_ATT_Cellular_IOT project, the parameters needed to customize your board are in the config_me.h file.

  • FLOW parameters: This project assumes you are using a fork of the Starter Kit Base project, which is a reference design created using AT&T’s FLOW (https://flow.att.com) that allows the creation of online virtualization and other IoT functionality. The default parameters in the config_me.h file are done for a specific instance of this project. When you fork the original project, you get your own instance and it will have its own base address. At the bottom of the FLOW environment, when you click on the Endpoints tab, URL information that is specific to your instance is displayed. Of note is the Base URL. In the example below (as in the default mbed project), the Base URL is: https://run-west.att.io/1e464b19cdcde/774c88d68202/86694923d5bf28a/in/flow You have to take note of two parts of this address. The run-west.att.io part is the server URL, and you have to make sure the
  • MY_SERVER_URL field in config_me.h matches this. The rest of the base URL, in green above, needs to be pasted into the FLOW_BASE_URL field.

There is also a FLOW_INPUT_NAME field. This should match the name of the HTTP IN port in the FLOW project that you want to send sensor data to. The default is "/climate", as in the FLOW image below.

/media/uploads/JMF/sf.png

Where is the Binary I compiled

When the COMPILE button is pressed, it compiles your project and links it. The result is placed in the DOWNLOAD folder you use when downloading files from the Internet. It will be called AvnetATT_shape_hackathon_K64F.bin.

Additional Information on Compiling/Configuring

Comprehensive instructions can be found at: Quick Start Instructions

Committer:
fkellermavnet
Date:
Thu Aug 11 00:03:09 2016 +0000
Revision:
68:6e311c747045
Parent:
64:09004cd610df
Child:
70:24d5800f27be
Added Avnet copyright headers on all source files.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
fkellermavnet 68:6e311c747045 1 /* ===================================================================
fkellermavnet 68:6e311c747045 2 Copyright © 2016, AVNET Inc.
fkellermavnet 68:6e311c747045 3
fkellermavnet 68:6e311c747045 4 Licensed under the Apache License, Version 2.0 (the "License");
fkellermavnet 68:6e311c747045 5 you may not use this file except in compliance with the License.
fkellermavnet 68:6e311c747045 6 You may obtain a copy of the License at
fkellermavnet 68:6e311c747045 7
fkellermavnet 68:6e311c747045 8 http://www.apache.org/licenses/LICENSE-2.0
fkellermavnet 68:6e311c747045 9
fkellermavnet 68:6e311c747045 10 Unless required by applicable law or agreed to in writing,
fkellermavnet 68:6e311c747045 11 software distributed under the License is distributed on an
fkellermavnet 68:6e311c747045 12 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
fkellermavnet 68:6e311c747045 13 either express or implied. See the License for the specific
fkellermavnet 68:6e311c747045 14 language governing permissions and limitations under the License.
fkellermavnet 68:6e311c747045 15
fkellermavnet 68:6e311c747045 16 ======================================================================== */
fkellermavnet 68:6e311c747045 17
stefanrousseau 55:3abf9e3f42e6 18 #include "mbed.h"
JMF 0:9d5134074d84 19 #include <cctype>
JMF 0:9d5134074d84 20 #include <string>
JMF 2:0e2ef866af95 21 #include "config_me.h"
stefanrousseau 4:f83bedd9cab4 22 #include "sensors.h"
stefanrousseau 61:f6b93129f954 23 #include "cell_modem.h"
stefanrousseau 11:e6602513730f 24 #include "hardware.h"
stefanrousseau 11:e6602513730f 25
stefanrousseau 61:f6b93129f954 26 I2C i2c(PTC11, PTC10); //SDA, SCL -- define the I2C pins being used
stefanrousseau 56:cb42ff383dab 27 MODSERIAL pc(USBTX, USBRX, 256, 256); // tx, rx with default tx, rx buffer sizes
stefanrousseau 63:90d7c69993cd 28 MODSERIAL mdm(PTD3, PTD2, 4096, 4096);
stefanrousseau 16:17c5916f2d12 29 DigitalOut led_green(LED_GREEN);
stefanrousseau 16:17c5916f2d12 30 DigitalOut led_red(LED_RED);
stefanrousseau 16:17c5916f2d12 31 DigitalOut led_blue(LED_BLUE);
JMF 0:9d5134074d84 32
JMF 0:9d5134074d84 33
stefanrousseau 3:26b3cc155f39 34 //********************************************************************************************************************************************
stefanrousseau 12:7c94ec5069dc 35 //* Create string with sensor readings that can be sent to flow as an HTTP get
stefanrousseau 3:26b3cc155f39 36 //********************************************************************************************************************************************
stefanrousseau 12:7c94ec5069dc 37 K64F_Sensors_t SENSOR_DATA =
stefanrousseau 3:26b3cc155f39 38 {
stefanrousseau 12:7c94ec5069dc 39 .Temperature = "0",
stefanrousseau 12:7c94ec5069dc 40 .Humidity = "0",
stefanrousseau 12:7c94ec5069dc 41 .AccelX = "0",
stefanrousseau 12:7c94ec5069dc 42 .AccelY = "0",
stefanrousseau 12:7c94ec5069dc 43 .AccelZ = "0",
stefanrousseau 12:7c94ec5069dc 44 .MagnetometerX = "0",
stefanrousseau 12:7c94ec5069dc 45 .MagnetometerY = "0",
stefanrousseau 12:7c94ec5069dc 46 .MagnetometerZ = "0",
stefanrousseau 12:7c94ec5069dc 47 .AmbientLightVis = "0",
stefanrousseau 12:7c94ec5069dc 48 .AmbientLightIr = "0",
stefanrousseau 12:7c94ec5069dc 49 .UVindex = "0",
stefanrousseau 12:7c94ec5069dc 50 .Proximity = "0",
stefanrousseau 12:7c94ec5069dc 51 .Temperature_Si7020 = "0",
stefanrousseau 55:3abf9e3f42e6 52 .Humidity_Si7020 = "0",
stefanrousseau 55:3abf9e3f42e6 53 .Virtual_Sensor1 = "0",
stefanrousseau 55:3abf9e3f42e6 54 .Virtual_Sensor2 = "0",
stefanrousseau 55:3abf9e3f42e6 55 .Virtual_Sensor3 = "0",
stefanrousseau 55:3abf9e3f42e6 56 .Virtual_Sensor4 = "0",
stefanrousseau 55:3abf9e3f42e6 57 .Virtual_Sensor5 = "0",
stefanrousseau 55:3abf9e3f42e6 58 .Virtual_Sensor6 = "0",
stefanrousseau 55:3abf9e3f42e6 59 .Virtual_Sensor7 = "0",
stefanrousseau 55:3abf9e3f42e6 60 .Virtual_Sensor8 = "0"
stefanrousseau 3:26b3cc155f39 61 };
stefanrousseau 12:7c94ec5069dc 62
stefanrousseau 3:26b3cc155f39 63 void GenerateModemString(char * modem_string)
stefanrousseau 3:26b3cc155f39 64 {
stefanrousseau 12:7c94ec5069dc 65 switch(iSensorsToReport)
stefanrousseau 12:7c94ec5069dc 66 {
stefanrousseau 12:7c94ec5069dc 67 case TEMP_HUMIDITY_ONLY:
stefanrousseau 12:7c94ec5069dc 68 {
stefanrousseau 12:7c94ec5069dc 69 sprintf(modem_string, "GET %s%s?serial=%s&temp=%s&humidity=%s %s%s\r\n\r\n", FLOW_BASE_URL, FLOW_INPUT_NAME, FLOW_DEVICE_NAME, SENSOR_DATA.Temperature, SENSOR_DATA.Humidity, FLOW_URL_TYPE, MY_SERVER_URL);
stefanrousseau 12:7c94ec5069dc 70 break;
stefanrousseau 12:7c94ec5069dc 71 }
stefanrousseau 12:7c94ec5069dc 72 case TEMP_HUMIDITY_ACCELEROMETER:
stefanrousseau 12:7c94ec5069dc 73 {
stefanrousseau 12:7c94ec5069dc 74 sprintf(modem_string, "GET %s%s?serial=%s&temp=%s&humidity=%s&accelX=%s&accelY=%s&accelZ=%s %s%s\r\n\r\n", FLOW_BASE_URL, FLOW_INPUT_NAME, FLOW_DEVICE_NAME, SENSOR_DATA.Temperature, SENSOR_DATA.Humidity, SENSOR_DATA.AccelX,SENSOR_DATA.AccelY,SENSOR_DATA.AccelZ, FLOW_URL_TYPE, MY_SERVER_URL);
stefanrousseau 12:7c94ec5069dc 75 break;
stefanrousseau 12:7c94ec5069dc 76 }
stefanrousseau 12:7c94ec5069dc 77 case TEMP_HUMIDITY_ACCELEROMETER_PMODSENSORS:
stefanrousseau 12:7c94ec5069dc 78 {
stefanrousseau 12:7c94ec5069dc 79 sprintf(modem_string, "GET %s%s?serial=%s&temp=%s&humidity=%s&accelX=%s&accelY=%s&accelZ=%s&proximity=%s&light_uv=%s&light_vis=%s&light_ir=%s %s%s\r\n\r\n", FLOW_BASE_URL, FLOW_INPUT_NAME, FLOW_DEVICE_NAME, SENSOR_DATA.Temperature, SENSOR_DATA.Humidity, SENSOR_DATA.AccelX,SENSOR_DATA.AccelY,SENSOR_DATA.AccelZ, SENSOR_DATA.Proximity, SENSOR_DATA.UVindex, SENSOR_DATA.AmbientLightVis, SENSOR_DATA.AmbientLightIr, FLOW_URL_TYPE, MY_SERVER_URL);
stefanrousseau 12:7c94ec5069dc 80 break;
stefanrousseau 12:7c94ec5069dc 81 }
stefanrousseau 55:3abf9e3f42e6 82 case TEMP_HUMIDITY_ACCELEROMETER_PMODSENSORS_VIRTUALSENSORS:
stefanrousseau 55:3abf9e3f42e6 83 {
stefanrousseau 55:3abf9e3f42e6 84 sprintf(modem_string, "GET %s%s?serial=%s&temp=%s&humidity=%s&accelX=%s&accelY=%s&accelZ=%s&proximity=%s&light_uv=%s&light_vis=%s&light_ir=%s&virt_sens1=%s&virt_sens2=%s&virt_sens3=%s&virt_sens4=%s&virt_sens5=%s&virt_sens6=%s&virt_sens7=%s&virt_sens8=%s %s%s\r\n\r\n", FLOW_BASE_URL, FLOW_INPUT_NAME, FLOW_DEVICE_NAME, SENSOR_DATA.Temperature, SENSOR_DATA.Humidity, SENSOR_DATA.AccelX,SENSOR_DATA.AccelY,SENSOR_DATA.AccelZ, SENSOR_DATA.Proximity, SENSOR_DATA.UVindex, SENSOR_DATA.AmbientLightVis, SENSOR_DATA.AmbientLightIr, SENSOR_DATA.Virtual_Sensor1, SENSOR_DATA.Virtual_Sensor2, SENSOR_DATA.Virtual_Sensor3, SENSOR_DATA.Virtual_Sensor4, SENSOR_DATA.Virtual_Sensor5, SENSOR_DATA.Virtual_Sensor6, SENSOR_DATA.Virtual_Sensor7, SENSOR_DATA.Virtual_Sensor8, FLOW_URL_TYPE, MY_SERVER_URL);
stefanrousseau 55:3abf9e3f42e6 85 break;
stefanrousseau 55:3abf9e3f42e6 86 }
stefanrousseau 12:7c94ec5069dc 87 default:
stefanrousseau 12:7c94ec5069dc 88 {
stefanrousseau 12:7c94ec5069dc 89 sprintf(modem_string, "Invalid sensor selected\r\n\r\n");
stefanrousseau 12:7c94ec5069dc 90 break;
stefanrousseau 12:7c94ec5069dc 91 }
stefanrousseau 16:17c5916f2d12 92 } //switch(iSensorsToReport)
stefanrousseau 3:26b3cc155f39 93 } //GenerateModemString
stefanrousseau 3:26b3cc155f39 94
stefanrousseau 3:26b3cc155f39 95
stefanrousseau 3:26b3cc155f39 96 //Periodic timer
stefanrousseau 3:26b3cc155f39 97 Ticker OneMsTicker;
stefanrousseau 3:26b3cc155f39 98 volatile bool bTimerExpiredFlag = false;
stefanrousseau 3:26b3cc155f39 99 int OneMsTicks = 0;
stefanrousseau 3:26b3cc155f39 100 int iTimer1Interval_ms = 1000;
stefanrousseau 3:26b3cc155f39 101 //********************************************************************************************************************************************
stefanrousseau 3:26b3cc155f39 102 //* Periodic 1ms timer tick
stefanrousseau 3:26b3cc155f39 103 //********************************************************************************************************************************************
stefanrousseau 3:26b3cc155f39 104 void OneMsFunction()
stefanrousseau 3:26b3cc155f39 105 {
stefanrousseau 3:26b3cc155f39 106 OneMsTicks++;
stefanrousseau 3:26b3cc155f39 107 if ((OneMsTicks % iTimer1Interval_ms) == 0)
stefanrousseau 3:26b3cc155f39 108 {
stefanrousseau 3:26b3cc155f39 109 bTimerExpiredFlag = true;
stefanrousseau 3:26b3cc155f39 110 }
stefanrousseau 3:26b3cc155f39 111 } //OneMsFunction()
stefanrousseau 3:26b3cc155f39 112
stefanrousseau 16:17c5916f2d12 113 //********************************************************************************************************************************************
stefanrousseau 16:17c5916f2d12 114 //* Set the RGB LED's Color
stefanrousseau 16:17c5916f2d12 115 //* LED Color 0=Off to 7=White. 3 bits represent BGR (bit0=Red, bit1=Green, bit2=Blue)
stefanrousseau 16:17c5916f2d12 116 //********************************************************************************************************************************************
stefanrousseau 16:17c5916f2d12 117 void SetLedColor(unsigned char ucColor)
stefanrousseau 16:17c5916f2d12 118 {
stefanrousseau 16:17c5916f2d12 119 //Note that when an LED is on, you write a 0 to it:
stefanrousseau 16:17c5916f2d12 120 led_red = !(ucColor & 0x1); //bit 0
stefanrousseau 16:17c5916f2d12 121 led_green = !(ucColor & 0x2); //bit 1
stefanrousseau 16:17c5916f2d12 122 led_blue = !(ucColor & 0x4); //bit 2
stefanrousseau 16:17c5916f2d12 123 } //SetLedColor()
stefanrousseau 16:17c5916f2d12 124
stefanrousseau 16:17c5916f2d12 125 //********************************************************************************************************************************************
stefanrousseau 61:f6b93129f954 126 //* Process the JSON response. In this example we are only extracting a LED color.
stefanrousseau 16:17c5916f2d12 127 //********************************************************************************************************************************************
stefanrousseau 16:17c5916f2d12 128 bool parse_JSON(char* json_string)
stefanrousseau 16:17c5916f2d12 129 {
stefanrousseau 16:17c5916f2d12 130 char* beginquote;
stefanrousseau 16:17c5916f2d12 131 char token[] = "\"LED\":\"";
stefanrousseau 16:17c5916f2d12 132 beginquote = strstr(json_string, token );
stefanrousseau 16:17c5916f2d12 133 if ((beginquote != 0))
stefanrousseau 16:17c5916f2d12 134 {
stefanrousseau 16:17c5916f2d12 135 char cLedColor = beginquote[strlen(token)];
stefanrousseau 64:09004cd610df 136 PRINTF(GRN "LED Found : %c" DEF "\r\n", cLedColor);
stefanrousseau 16:17c5916f2d12 137 switch(cLedColor)
stefanrousseau 16:17c5916f2d12 138 {
stefanrousseau 16:17c5916f2d12 139 case 'O':
stefanrousseau 16:17c5916f2d12 140 { //Off
stefanrousseau 16:17c5916f2d12 141 SetLedColor(0);
stefanrousseau 16:17c5916f2d12 142 break;
stefanrousseau 16:17c5916f2d12 143 }
stefanrousseau 16:17c5916f2d12 144 case 'R':
stefanrousseau 16:17c5916f2d12 145 { //Red
stefanrousseau 16:17c5916f2d12 146 SetLedColor(1);
stefanrousseau 16:17c5916f2d12 147 break;
stefanrousseau 16:17c5916f2d12 148 }
stefanrousseau 16:17c5916f2d12 149 case 'G':
stefanrousseau 16:17c5916f2d12 150 { //Green
stefanrousseau 16:17c5916f2d12 151 SetLedColor(2);
stefanrousseau 16:17c5916f2d12 152 break;
stefanrousseau 16:17c5916f2d12 153 }
stefanrousseau 16:17c5916f2d12 154 case 'Y':
stefanrousseau 16:17c5916f2d12 155 { //Yellow
stefanrousseau 16:17c5916f2d12 156 SetLedColor(3);
stefanrousseau 16:17c5916f2d12 157 break;
stefanrousseau 16:17c5916f2d12 158 }
stefanrousseau 16:17c5916f2d12 159 case 'B':
stefanrousseau 16:17c5916f2d12 160 { //Blue
stefanrousseau 16:17c5916f2d12 161 SetLedColor(4);
stefanrousseau 16:17c5916f2d12 162 break;
stefanrousseau 16:17c5916f2d12 163 }
stefanrousseau 16:17c5916f2d12 164 case 'M':
stefanrousseau 16:17c5916f2d12 165 { //Magenta
stefanrousseau 16:17c5916f2d12 166 SetLedColor(5);
stefanrousseau 16:17c5916f2d12 167 break;
stefanrousseau 16:17c5916f2d12 168 }
stefanrousseau 16:17c5916f2d12 169 case 'T':
stefanrousseau 16:17c5916f2d12 170 { //Turquoise
stefanrousseau 16:17c5916f2d12 171 SetLedColor(6);
stefanrousseau 16:17c5916f2d12 172 break;
stefanrousseau 16:17c5916f2d12 173 }
stefanrousseau 16:17c5916f2d12 174 case 'W':
stefanrousseau 16:17c5916f2d12 175 { //White
stefanrousseau 16:17c5916f2d12 176 SetLedColor(7);
stefanrousseau 16:17c5916f2d12 177 break;
stefanrousseau 16:17c5916f2d12 178 }
stefanrousseau 16:17c5916f2d12 179 default:
stefanrousseau 16:17c5916f2d12 180 {
stefanrousseau 16:17c5916f2d12 181 break;
stefanrousseau 16:17c5916f2d12 182 }
stefanrousseau 16:17c5916f2d12 183 } //switch(cLedColor)
stefanrousseau 16:17c5916f2d12 184 return true;
stefanrousseau 16:17c5916f2d12 185 }
stefanrousseau 16:17c5916f2d12 186 else
stefanrousseau 16:17c5916f2d12 187 {
stefanrousseau 16:17c5916f2d12 188 return false;
stefanrousseau 16:17c5916f2d12 189 }
stefanrousseau 16:17c5916f2d12 190 } //parse_JSON
stefanrousseau 16:17c5916f2d12 191
JMF 0:9d5134074d84 192 int main() {
stefanrousseau 61:f6b93129f954 193 static unsigned ledOnce = 0;
fkellermavnet 20:27a4f27254d0 194
stefanrousseau 61:f6b93129f954 195 pc.baud(115200);
stefanrousseau 64:09004cd610df 196 PRINTF(GRN "Hello World from the Cellular IoT Kit!\r\n\r\n");
JMF 0:9d5134074d84 197
stefanrousseau 61:f6b93129f954 198 //Initialize the I2C sensors that are present
stefanrousseau 11:e6602513730f 199 sensors_init();
stefanrousseau 12:7c94ec5069dc 200 read_sensors();
stefanrousseau 11:e6602513730f 201
stefanrousseau 61:f6b93129f954 202 // Set LED to RED until init finishes
stefanrousseau 61:f6b93129f954 203 SetLedColor(0x1); //Red
JMF 0:9d5134074d84 204 // Initialize the modem
stefanrousseau 64:09004cd610df 205 PRINTF("\r\n");
stefanrousseau 61:f6b93129f954 206 cell_modem_init();
stefanrousseau 61:f6b93129f954 207 // Set LED BLUE for partial init
stefanrousseau 61:f6b93129f954 208 SetLedColor(0x4); //Blue
JMF 0:9d5134074d84 209
stefanrousseau 3:26b3cc155f39 210 //Create a 1ms timer tick function:
stefanrousseau 61:f6b93129f954 211 iTimer1Interval_ms = SENSOR_UPDATE_INTERVAL_MS;
stefanrousseau 3:26b3cc155f39 212 OneMsTicker.attach(OneMsFunction, 0.001f) ;
fkellermavnet 26:8d6e7e7cdcae 213
JMF 2:0e2ef866af95 214 // Send and receive data perpetually
JMF 2:0e2ef866af95 215 while(1) {
stefanrousseau 55:3abf9e3f42e6 216 #ifdef USE_VIRTUAL_SENSORS
stefanrousseau 55:3abf9e3f42e6 217 ProcessUsbInterface();
stefanrousseau 55:3abf9e3f42e6 218 #endif
stefanrousseau 3:26b3cc155f39 219 if (bTimerExpiredFlag)
stefanrousseau 3:26b3cc155f39 220 {
stefanrousseau 3:26b3cc155f39 221 bTimerExpiredFlag = false;
stefanrousseau 4:f83bedd9cab4 222 read_sensors(); //read available external sensors from a PMOD and the on-board motion sensor
stefanrousseau 3:26b3cc155f39 223 char modem_string[512];
stefanrousseau 3:26b3cc155f39 224 GenerateModemString(&modem_string[0]);
stefanrousseau 61:f6b93129f954 225 char myJsonResponse[512];
stefanrousseau 61:f6b93129f954 226 if (cell_modem_Sendreceive(&modem_string[0], &myJsonResponse[0]))
fkellermavnet 20:27a4f27254d0 227 {
stefanrousseau 41:9b14c40eebf6 228 if (!ledOnce)
stefanrousseau 41:9b14c40eebf6 229 {
stefanrousseau 41:9b14c40eebf6 230 ledOnce = 1;
stefanrousseau 61:f6b93129f954 231 SetLedColor(0x2); //Green
stefanrousseau 41:9b14c40eebf6 232 }
stefanrousseau 61:f6b93129f954 233 parse_JSON(&myJsonResponse[0]);
stefanrousseau 16:17c5916f2d12 234 }
stefanrousseau 3:26b3cc155f39 235 } //bTimerExpiredFlag
stefanrousseau 3:26b3cc155f39 236 } //forever loop
JMF 0:9d5134074d84 237 }