Test code to interface AOD UPAS with IoT provider.
Dependencies: ESP8266_AT NCP5623BMUTBG mbed ADS1115 AOD_Calculation BME280 PMS5003 SunPosition CAM_M8
Diff: main.cpp
- Revision:
- 5:513617961138
- Parent:
- 4:8a667120ee2b
- Child:
- 6:aeb0015d6632
--- a/main.cpp Mon Nov 27 00:52:52 2017 +0000 +++ b/main.cpp Wed Dec 06 02:23:22 2017 +0000 @@ -101,8 +101,11 @@ Timer t; +//char ssid[] = "w212lab"; +//char password[] = "testarduino"; char ssid[] = "VOLTAR"; char password[] = "CedhCedh"; + char server[] = "api.thingspeak.com"; char apiKey[] = "32QVSK5INPPAVIV0"; char conn_type[] = "TCP"; @@ -255,16 +258,16 @@ radius = sun.getRadius(); //Read the light detectors - v_raw870 = (double)ads_sun.readADC_SingleEnded(A3_GAIN_ONE); //Channel A3 | 1x gain | +/-4.096V | 1 bit = 2mV | 0.125mV + v_raw870 = (double)ads_sun.readADC_SingleEnded(A3_GAIN_TWO); //Channel A3 | 1x gain | +/-4.096V | 1 bit = 2mV | 0.125mV v870 = (v_raw870*0.125)/(1000); //Converts to a voltage - v_raw680 = (double)ads_sun.readADC_SingleEnded(A2_GAIN_ONE); //Channel A2 | 1x gain | +/-4.096V | 1 bit = 2mV | 0.125mV + v_raw680 = (double)ads_sun.readADC_SingleEnded(A2_GAIN_TWO); //Channel A2 | 1x gain | +/-4.096V | 1 bit = 2mV | 0.125mV v680 = (v_raw680*0.125)/(1000); //Converts to a voltage - v_raw520 = (double)ads_sun.readADC_SingleEnded(A1_GAIN_ONE); //Channel A1 | 1x gain | +/-4.096V | 1 bit = 2mV | 0.125mV + v_raw520 = (double)ads_sun.readADC_SingleEnded(A1_GAIN_TWO); //Channel A1 | 1x gain | +/-4.096V | 1 bit = 2mV | 0.125mV v520 = (v_raw520*0.125)/(1000); //Converts to a voltage - v_raw440 = (double)ads_sun.readADC_SingleEnded(A0_GAIN_ONE); //Channel A1 | 1x gain | +/-4.096V | 1 bit = 2mV | 0.125mV + v_raw440 = (double)ads_sun.readADC_SingleEnded(A0_GAIN_TWO); //Channel A1 | 1x gain | +/-4.096V | 1 bit = 2mV | 0.125mV v440 = (v_raw520*0.125)/(1000); //Converts to a voltage //Calculate the AOD for all channels