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

Blynk Button State in Python


#1

I’ve been looking all over the forums and can’t find the answer or topic related to this. I would like to know how to read the app button state in python so, depending on the state, I could control GPIO pin HIGH or LOW. Any help will be appreciated. I’ve used WiringPy and it works, but I need to use it inside my Blynk app. This is for a Raspberry Pi 3b

Thanks.


#2

Blynk Python was in Alpha not too long ago… not sure it’s status now. But always best to refer to the GitHub pages examples for clues how to run the commands. Digging into the library file can also be a clue for commands not shown in the examples (like set parameter)

Meanwhile, I just (yesterday?) posted an example of how to changes images in the Image Gallery Widget, with both C++ and Python, based on a button press. You would just substitute the virtual write with your choice of GPIO control


#3

WOW. Excellent. I knew I was on the right track, but the def was what threw me off. Worked like a charm! Thanks!!!