seby
February 22, 2018, 8:17pm
1
Hello I created a sketch on arduino with a button “turn it all off” then pressing the d7 button go off d2-d3-d4 etc …, now the problem is that if I turn off the buttons that are turned on via the “Shutdown all”
"they really turn off but they always stay ON in the app blynk, does anyone know how to fix? the buttons are all synchronized the state of widgets with hardware states,
even if hardware resets or looses connection temporarily
Thanks.
Gunner
February 22, 2018, 8:18pm
2
And the code that does all this is…?
seby
February 22, 2018, 8:22pm
3
//#define BLYNK_PRINT DebugSerial
#define BLYNK_PRINT SwSerial //LED
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(0, 1); // RX, TX
SoftwareSerial SwSerial(10, 11); // RX, TX
#include <BlynkSimpleStream.h>
int pin2 = 2;
int pin3 = 3;
int pulsante = 7;
int stato_pulsante;
void setup() {
pinMode(pin2, OUTPUT);
pinMode(pin3, OUTPUT);
pinMode(pulsante, INPUT);
DebugSerial.begin(9600);
Serial.begin(9600);
Blynk.begin(Serial, auth);
SwSerial.begin(9600);
}
void loop() {
stato_pulsante = digitalRead(pulsante);
if (stato_pulsante == HIGH) {
digitalWrite(pin2, HIGH);
digitalWrite(pin3, HIGH);
Blynk.run();
}
Gunner
February 22, 2018, 8:29pm
4
Absolutely nothing Blynk related that (originally posted) code… and it is missing closing brackets… are you in the correct forum
seby
February 22, 2018, 8:37pm
5
And I had forgotten the brackets :), and there is no way to synchronize the change to blynk app ?
Gunner
February 22, 2018, 8:56pm
6
Lots of ways… but they require Virtual pins, Blynk functions, commands, etc. Search this forum for keywords like syncing physical buttons/pins with App buttons etc… even one example here…
seby
February 22, 2018, 9:04pm
7
in another test I created the virtual pin led and it works perfectly only that I can not sync the graphic buttons that always remain ON
Gunner
February 22, 2018, 9:31pm
8
Dude… try searching this forum for the many other topics and examples showing how to do that exact thing
For example… a button widget being synchronized with another timer action to properly show the current pin state.
I just recently used this exact type of example for another topic… How to use two widgets on same digital pin
But I will paste it here as well.
E.g. For simplicity, I am just using a using a Button Widget (set to Switch mode) on V0 and the Timer Widget on V1 to turn ON or OFF the same LED on a digital pin (including feedback to the Button when the timer kicks in ) Assuming built in LED on Arduino’s pin 13
BLYNK_WRITE(V0) { // Button Widget function
digitalWrite(13, param.asInt()); …
1 Like