are these features correct for a single timer?
timer.setInterval(800L, buttonLedWidget);
.......
void buttonLedWidget(){
if ( digitalRead (inp5)==0){led5.on(); } else {led5.off(); }
if ( digitalRead (inp6)==0){led6.on(); } else {led6.off();Blynk.notify("PLC Stop !!!");}
if ( digitalRead (inp12)==0){led12.on(); } else {led12.off();}
if ( digitalRead (inp18)==0){led18.on();Blynk.notify("Alarm"); } else {led18.off();}
if ( digitalRead (inp27)==1){;Blynk.notify("Test"); }
if ( digitalRead (inp29)==1){led29.on();} else {led29.off();}
if ( digitalRead (inp37)==1){led37.on();} else {led37.off();}
if ( digitalRead (inp45)==1){led29.on();} else {led45.off();}
if ( digitalRead (inp47)==1){led47.on();} else {led47.off();}
}
I have problems of disconnection, there are too many functions I have to set timers with different times for each single reading?
If you increase the time from 800 to say, 1800 does the problem go away?
If so, I suspect the Blynk calls may be too frequent.
I’d capture the time at the beginning and end of the function …
void buttonLedWidget(){
long int start_time = millis();
// ...
Serial.println(millis() - start_time);
}
Put a few Blynk.run();
commands in your function, say after ever two or thee digital ‘if’ statements.
Pete.
Gunner
April 1, 2019, 5:35pm
6
You have nothing preventing these notifications from attempting to process each timer iteration (if the pin is the needed value). But there is a 5 second limit between consecutive calls.
http://docs.blynk.cc/#widgets-notifications
Mirko_Consoli:
time result is 14
That’s 14 ms. I’d probably look elsewhere for your disconnection issue.
messages are sent very rarely. I will soon put a time limitation
I have tried every cause but I have the same result.
I also increased the timer time to 1000L
If you’ve tried adding extra Blynk.run commands then perhaps you should post your full code and a few more details about exactly what symptoms you’re seeing and what you get in your serial monitor.
Pete.
the problem was the network card, certainly defective. I mounted a w5100 and it is working fine without Blink.run in the middle of if.
The process time has dropped to 6ms
1 Like
I spent soooo much time messing around with various Ethernet shields and libraries for the Arduino before I finally saw the light.
I thought I’d write a piece about my thoughts on the best hardware to use for your IoT projects if you’re just starting-out with Blynk.
I did what many people do, started-off buying an Arduino Uno and uploaded some code to make it flash an LED. After about 10 seconds of watching the LED flash I was bored, and wanted to do more (I have a short attention span ).
The next task was getting the Uno connected to the internet and I chose the Ethernet Shield route. After around 6 months of m…
Pete.