Ok, no fear to look like stupid
What’s wrong here? The label V5 displays the text, but the LED stays off…
//JUST CONNECT+WD Rx //BLYNK2.0
//V1.1: to test stability connection & debug (23650/1357) -> reconnect OK après ~60sec perte réseau
//V1.2: Blynk.config() au lieu de Blynk.begin() (23320/1367) -> reconnect OK après ~270sec perte réseau
//<<LIBRARIES>>
#define BLYNK_TEMPLATE_ID "TMPLXnFLWBcV"
#define BLYNK_DEVICE_NAME "TEST1"
#define BLYNK_PRINT Serial // Comment this out to disable prints and save flash space
//#define BLYNK_DEBUG // Optional, this enables lots of prints
#define BLYNK_NO_BUILTIN // Disable built-in analog & digital pin operations to spare flash space
#define BLYNK_NO_FLOAT // Disable float operations to spare flash space
#define BLYNK_NO_INFO // Skip device info to spare flash space
#include <BlynkSimpleUIPEthernet.h> // ENC28J60 ethernet BLYNK library
char auth[] = "?????????????????????XXX";
/////
WidgetLED led1(V1);
/////
unsigned long lastRunTime; //mémoire du timing de la dernière requête au NANO Slave
char Flag_Init_Boot='0';
byte FlipFlop = 0;
void setup() {
Serial.begin(9600); // start serial for output
Blynk.begin(auth);
}
void loop(){
unsigned long currentTime = millis();
while (Blynk.connected()==false) {Blynk.disconnect(); Blynk.connect();} //wait connection serveur//semble mieux reprendre la connexion que Blynk.run(); //reste true ~10sec qd la connexion est perdue -> cfr heartbeat? & la boucle tourne au ralentis (~15sec) qd =false -> cfr fonctions discoonnect/connect?
Blynk.run();
if (Flag_Init_Boot=='0'){
led1.on();
Flag_Init_Boot='1';
}
if (currentTime - lastRunTime >= 2000){ //change led V11 toutes les 2sec
lastRunTime = currentTime;
if (FlipFlop == 0) {WidgetColor("#FF00FF");Blynk.virtualWrite(V5, "Fini Blynk 1.0 :(");FlipFlop=1;} //LED Magenta
else {WidgetColor("#23C48E");Blynk.virtualWrite(V5, "C'est parti pour BLYNK 2.0 ! :)");FlipFlop=0;} //LED Verte
}
}
void WidgetColor(char Couleur[]) { //fonction pour changer les propriétés couleurs des widget (vert=ok / jaune=essaimge / rouge=incident / magenta=config&boot / noir=stop&start)
Blynk.setProperty(V1, "color", Couleur);
}