BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Can't SYNC PHYSICAL BUTTON WITH APP

THANKS
Physical buttons ( up and down) and virtual buttons (V3&V4 in push state) are only for fading, there is no sync needed in those cases. I only want you to have a look at the
void checkPhysical PowerButton(); function and Blynk_Write (V2 ) function i.e button widget in switch state ONLY. If i press physical power button, should’nt it CHANGE V2 state in APP
THANKS AGAIN,plz take a look

First of all, you need to learn to indent your code so that it’s easier to see how the various if statements will work. You also need to use if && statements where you want to test two parameters rather than having multiple nested if statements.
You have at lease one else if statement without any parameters, which is never going to give the results you expect.

Secondly, you need to be able to access debug serial data and add serial print statements to be able to monitor the value of your variables and the program flow through the maze of if statements.
Connecting a non IoT board to the internet via a USB connection isn’t a sustainable connection method, it’s just meant as a way of doing a quick & dirty connection to give people a flavour of what’s available with Blynk. If you’re tied to this method for some bizarre reason then at the very least you need an FTDI adapter to enable you to view serial debug data.
In reality, you need to be using an IoT enabled board such as a NodeMCU or ESP32, which incidentally are much cheaper and more powerful than the Arduino Uno boards.

Looking at this badly presented and badly written code hurts my eyes and my brain!

Pete.

1 Like

USING NODE-MCU BOARD INSTEAD OF ARDUINO UNO SOLVED THE PROBLEM.
dont know why but it did.
THANKS ALL.