Test code to interface AOD UPAS with IoT provider.

Dependencies:   ESP8266_AT NCP5623BMUTBG mbed ADS1115 AOD_Calculation BME280 PMS5003 SunPosition CAM_M8

Revision:
2:3df874f33c42
Parent:
1:702f144a88b2
Child:
3:f878eab2ebe0
diff -r 702f144a88b2 -r 3df874f33c42 main.cpp
--- a/main.cpp	Wed Nov 22 01:36:27 2017 +0000
+++ b/main.cpp	Wed Nov 22 04:47:21 2017 +0000
@@ -5,36 +5,36 @@
 /////////////////////////////////////////////
 //Define core buses and pin states.
 /////////////////////////////////////////////
-I2C                 i2c(PB_9, PB_8);//(D14, D15); SDA,SCL
-Serial              pc(USBTX, USBRX);
-DigitalOut          pumps(PA_9, 0);//(D8, 0);
-DigitalOut          pbKill(PC_12, 1); // Digital input pin that conncect to the LTC2950 battery charger used to shutdown the UPAS 
-DigitalIn           nINT(PA_15); //Connected but currently unused is a digital ouput pin from LTC2950 battery charger. http://cds.linear.com/docs/en/datasheet/295012fd.pdf
-NCP5623BMUTBG       RGB_LED(PB_9, PB_8);    //(D14, D15);
+I2C             i2c(PB_9, PB_8);//(D14, D15); SDA,SCL
+Serial          pc(USBTX, USBRX);
+DigitalOut      pumps(PA_9, 0);//(D8, 0);
+DigitalOut      pbKill(PC_12, 1); // Digital input pin that conncect to the LTC2950 battery charger used to shutdown the UPAS 
+DigitalIn       nINT(PA_15); //Connected but currently unused is a digital ouput pin from LTC2950 battery charger. http://cds.linear.com/docs/en/datasheet/295012fd.pdf
+NCP5623BMUTBG   RGB_LED(PB_9, PB_8);    //(D14, D15);
 
 /////////////////////////////////////////////
 //RN4677 BT/BLE Module
 /////////////////////////////////////////////
-Serial              ble(PB_10, PB_11);
-DigitalOut          bleRTS(PB_14, 0);
-DigitalOut          bleCTS(PB_13, 0);
-DigitalOut          BT_IRST(PC_8, 0);
-DigitalOut          BT_SW(PA_12, 0);
+Serial          ble(PB_10, PB_11);
+DigitalOut      bleRTS(PB_14, 0);
+DigitalOut      bleCTS(PB_13, 0);
+DigitalOut      BT_IRST(PC_8, 0);
+DigitalOut      BT_SW(PA_12, 0);
 
 
 /////////////////////////////////////////////
 //Analog to Digital Converter
 /////////////////////////////////////////////
-DigitalIn           ADS_ALRT(PA_10); //Connected but currently unused. (ADS1115) http://www.ti.com/lit/ds/symlink/ads1115.pdf
+DigitalIn       ADS_ALRT(PA_10); //Connected but currently unused. (ADS1115) http://www.ti.com/lit/ds/symlink/ads1115.pdf
 
 /////////////////////////////////////////////
 //Battery, Charger, & Supply Monitoring
 /////////////////////////////////////////////
-DigitalIn             LTCALT(PB_2); //High for normal operation. Low when a threshold is exceeded for Voltage, gas gauge, or temp
-DigitalIn             bcs1(PC_9); //Batt charging if High. (BQ24100)[U23]
-DigitalIn             bcs2(PA_8); //Charge complete if High. (BQ24100)[U23]  
-DigitalIn             bc_npg(PB_1); //Power to the charge controller. (BQ24100)[U23] 
-DigitalIn             SW3flt(PC_4); //When EN = 0 pin is HIGH, When EN = 1, LOW can be current limit, thermal limit, or UVLO.
+DigitalIn       LTCALT(PB_2); //High for normal operation. Low when a threshold is exceeded for Voltage, gas gauge, or temp
+DigitalIn       bcs1(PC_9); //Batt charging if High. (BQ24100)[U23]
+DigitalIn       bcs2(PA_8); //Charge complete if High. (BQ24100)[U23]  
+DigitalIn       bc_npg(PB_1); //Power to the charge controller. (BQ24100)[U23] 
+DigitalIn       SW3flt(PC_4); //When EN = 0 pin is HIGH, When EN = 1, LOW can be current limit, thermal limit, or UVLO.
 
 /////////////////////////////////////////////
 //Sensirion SDP3X(s)
@@ -157,8 +157,9 @@
             
             esp.delete_tcp_server();
             esp.establish_connection(0, conn_type, server, 80);
+            esp.send_data_tcp(0, someArray);
+            esp.close_connection(0);
             esp.create_tcp_server(80);
-            esp.close_connection(0);
             pc.printf("%s\r\n", someArray);
         }
     }