Hi everyone.
I'm VERY new to Arduino, I'm more used to various types of Basic.
What I am trying to do is the following.
Use an ESP8266-01 to get weather data from DarkSky via my php server which parses and only sends the required data to the ESP8266
This works great at the moment and it sends the received data to the serial port where it is processed by another unit, parsed and sent to a 7inch tft display.
What I want to do is -
Split the received data into 2 or 3 sections and send each section separately to the serial port instead of it all being sent at once.
This is my code which works great so far
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#define USE_SERIAL Serial
ESP8266WiFiMulti WiFiMulti;
void setup() {
USE_SERIAL.begin(115200);
for(uint8_t t = 4; t > 0; t--) {
USE_SERIAL.flush();
delay(1000);
}
WiFi.mode(WIFI_STA);
WiFiMulti.addAP("MI5-Surveillance", "11071986");
}
void loop() {
// wait for WiFi connection
if((WiFiMulti.run() == WL_CONNECTED)) {
HTTPClient http;
// USE_SERIAL.print("[HTTP] begin...\n");
// configure server and url
http.begin("http://MYSERVERADDRESS:64246/weather.php?apiKey=API-KEY-HERE&lat=53.4&lon=-2.1&units=uk2"); //HTTP
USE_SERIAL.print("[HTTP] GET...\n");
// start connection and send HTTP header
int httpCode = http.GET();
// httpCode will be negative on error
if(httpCode > 0) {
// HTTP header has been send and Server response header has been handled
// USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);
// file found at server
if(httpCode == HTTP_CODE_OK) {
String payload = http.getString();
USE_SERIAL.println(payload);
}
} else {
USE_SERIAL.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
}
http.end();
}
delay(90000); // delay 90 seconds as we cannot have more than 1000 calls per day
}
This is the data received from the ESP8266 via the com port
START , Fri , Time 13:56:10 27-04-2018 , Summary Rain , Temperature 8.1 , FeelsLike 6.27 , WindSpeed 6.58 , WindBearing 78 , Pressure 1007.87 , Humidity 80 , Visibility 5.7 , uvIndex 3 , Icon rain , Fri , Min : 5.34 , Max : 10.38 , partly-cloudy-day , Sunrise 05:43 , Sunset 20:31 , Pressure 1007.87 , Chance of Rain 0.84 , Mostly cloudy throughout the day. , Sat , Min : 6.02 , Max : 12.41 , partly-cloudy-day , Chance of Rain 0.46 , Mostly cloudy throughout the day. , Sat , partly-cloudy-day , Chance of Rain 0.45 , Mostly cloudy throughout the day. , Sun , wind Chance of Rain 0.64 , Overcast throughout the day and breezy until afternoon. , Sun , 29-04-2018 , partly-cloudy-day , Chance of Rain 0.55 , Mostly cloudy until evening. , END
Any ideas or suggestions on how to finish it by sending the data in 3 chunks instead of all in one section?
