I’d like to create a widget (like a LED) that would light to indicate that my hardware (photon) is connected and online. This would essentially be a way to have confidence that the data I am looking at is live.
Any suggestions?
I’d like to create a widget (like a LED) that would light to indicate that my hardware (photon) is connected and online. This would essentially be a way to have confidence that the data I am looking at is live.
Any suggestions?
I’ve tried to develop the same thing with code but have had no luck.
However, I become used to using the Uptime of the device and write it to a virtual pin. If its counting up then its online… itf not then its off Not as nice as an LED widget but works.
Here is some code to get you started. Also thrown in the wifi signal (if you are using wifi) which should bounce up and down giving you another value to monitor.
#include <SimpleTimer.h>
SimpleTimer timer;
void sendUptime() {
Blynk.virtualWrite(0, millis() / 1000);
Blynk.virtualWrite(1, map(WiFi.RSSI(), -105, -40, 0, 100) );
}
void setup(){
timer.setInterval(1000L, sendUptime);
}
void loop(){
timer.run();
}
you can try to have a virtual led (widget) to pulsing on-off-on … each second like this:
/// This blink LED function be called every second by SimpleTimer ///
void blinkLedWidget()
{
if (led1.getValue()) {
led1.off();
BLYNK_LOG("LED1: off");
} else {
led1.on();
BLYNK_LOG("LED1: on");
}
}
Another option I like is to add something blinking in your project (if it makes sense/applies).
For example, pretend you had a clock in your project. You could program the colon to blink:
The above obviously isn’t from a Blynk project, but here you’d know if the colon stops blinking that there’s a connection issue.
Well, maybe a clock isn’t the best implementation, but here’s one of the things I use (as long as dots are flashing, the thing is breathing!):
it’s the best way for me to check hardware online. I use it for all projects.
We all have different ways of doing the same thing… maybe blynk should just add a timeout value on the LED widget so if a command isnt received after X time, the LED turns off. (so just send a command to it every second and if no command is received after 1 second, turn off).
In my project, I use combination of blink Virtual LED and embedded hardware LED on NodeMCU, so when it stop blinking its tell me something wrong with the connection. I also add email notification (on BLYNK_CONNECTED) so each time the connection is resume it will notify me by email … Just my thought …
best regards
Can you explain this way?
It was a suggestion that maybe Blynk should develop some functionality.
The functionality wasn’t developed in that way, instead the online indicator at the top of the screen was developed instead (although someone recently said that this isn’t available in shared projects, but I’ve not yet tested this).
Pete.