Hi all,
I need to get the data from the feeds I have at IO Adafruit. I have an arduino 8266 on a remote location that send data to a dashboard at IO Adafruit and it's working well but I need to use a computer or my iPhone to see the data and I want to do that with another 8266 at home.
My 8266 at home is connecting to my account at IOT adafruit and evantually it will show it on an LCD display. For now it's only on Serial.print and it's enought for my test.
My problem is the following. I can get the data from 5 feeds but when I try to get the data for more than 5 feeds, all feeds after 5 are not working. No error message, I just don't get the data for more than 5 feeds.
The syntaxe is ok for those because If I cancell any of the frist five, the sixth one start working.
Maybe it's a limit of data with "onMessage"
#include "config.h"
#include <ESP8266WiFi.h>
#define Green 15 //LED to show I'm connected to Wi-Fi
#define Yellow 2 //LED to show I didn't received any data since..
//variables to store the data received from Feeds (IO Adafruit) for serial print
int Level_Bleu = 0;
int Flow_Bleu = 0;
int Level_Noir = 0;
int Sunshine = 0;
int E_D_H = 0;
int Batt_Volts = 0;
//Getting the feeds from my IO Adafruit dashboard
AdafruitIO_Feed *LevelBleu = io.feed("levelbleu");
AdafruitIO_Feed *FlowBleu = io.feed("flowbleu");
AdafruitIO_Feed *LevelNoir = io.feed("levelnoir");
AdafruitIO_Feed *Wlux = io.feed("wlux");
AdafruitIO_Feed *EDH = io.feed("detectedh");
AdafruitIO_Feed *BattVolts = io.feed("1-rv-batt");
int RemoteDataRX_Check = 0;
unsigned long previousMillis_1 = 0;
const long interval_1 = 1000;
void setup() {
pinMode(Green, OUTPUT);
digitalWrite(Green, LOW);
pinMode(Yellow, OUTPUT);
digitalWrite(Yellow, LOW);;
Serial.begin(115200);
//*********************WiFi connexion and adafruit status
//wait for serial monitor to open
while(! Serial);
//connect to io.adafruit.com
Serial.println("Connecting to Adafruit IO");
io.connect();
LevelBleu->onMessage(handleMessage1);
FlowBleu->onMessage(handleMessage2);
LevelNoir->onMessage(handleMessage3);
Wlux->onMessage(handleMessage4);
EDH->onMessage(handleMessage5);
BattVolts->onMessage(handleMessage6);
// wait for a connection
while(io.status() < AIO_CONNECTED) {
Serial.println(".");
Serial.println();
Serial.println(io.statusText());
delay(500);
}
}
void handleMessage1(AdafruitIO_Data *data) {
Serial.print("Level Bleu <- ");Serial.println(data->toInt());Level_Bleu = data->toInt();RemoteDataRX_Check = 0;}
void handleMessage2(AdafruitIO_Data *data) {
Serial.print("Flow Bleu <- ");Serial.println(data->toInt());Flow_Bleu = data->toInt();RemoteDataRX_Check = 0;}
void handleMessage3(AdafruitIO_Data *data) {
Serial.print("Level Noir <- ");Serial.println(data->toInt());Level_Noir = data->toInt();RemoteDataRX_Check = 0;}
void handleMessage4(AdafruitIO_Data *data) {
Serial.print("Sunshine <- ");Serial.println(data->toInt());Sunshine = data->toInt();RemoteDataRX_Check = 0;}
void handleMessage5(AdafruitIO_Data *data) {
Serial.print("EDH<- ");Serial.println(data->toInt());E_D_H = data->toInt();RemoteDataRX_Check = 0;}
void handleMessage6(AdafruitIO_Data *data) {
Serial.print("Batt Volts<- ");Serial.println(data->toInt());Batt_Volts = data->toInt();RemoteDataRX_Check = 0;}
void connectionCheck(){
if(WiFi.status()>= WL_CONNECTED){
digitalWrite(Green, HIGH);
}
if(WiFi.status()!= WL_CONNECTED){
digitalWrite(Green, LOW);
}
}
void VR_RemoteDataRX_Check(){
unsigned long currentMillis_1 = millis();
if (currentMillis_1 - previousMillis_1 >= interval_1){
RemoteDataRX_Check++;
Serial.print("********************** Data Delay OK = ");
Serial.println(RemoteDataRX_Check);
previousMillis_1 = currentMillis_1;
}
if (RemoteDataRX_Check >= 90){
digitalWrite(Yellow, HIGH);
Serial.println("***************Missing Data");
}else{
digitalWrite(Yellow, LOW);
}
}
void SerialPrint(){
Serial.print("**************Level Bleu: ");Serial.println(Level_Bleu);
Serial.print("**************Flow Bleu: ");Serial.println(Flow_Bleu);
Serial.print("**************Level Noir: ");Serial.println(Level_Noir);
Serial.print("**************Sunshine: ");Serial.println(Sunshine);
Serial.print("**************EDH: ");Serial.println(E_D_H);
Serial.print("**************Dc Batt: ");Serial.println(Batt_Volts);
}
void loop() {
io.run();
connectionCheck();
VR_RemoteDataRX_Check();
//SerialPrint();
delay(300);
}