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

Python to Arduino via Blynk

Hi!

I am trying to export an output integer (that continuously changes) from a Python script to my Arduino script so it can be used in a calculation running on the Arduino and the result later outputted to Blynk.
I am unable to use a serial connection for a direct transfer from Python to Arduino as I am already using a USB serial connection to connect my Arduino to Blynk.
I therefore have been trying to use the Blynk Python library to send the value from Python to a Blynk virtual pin in the hope that the Arduino can then retrieve this value via its Blynk connection.
While the correct value from Python shows on the Blynk app when I add a input field assigned to the virtual pin, I am however unable to get my Arduino code to retrieve the value. I have trued using the BLYNK_WRITE function, however it seems that this function only triggers when the virtual pin value is updated from an app widget (e.g. movement of a slider), and does not trigger when the value on the virtual pin itself (from Python) changes? Would really appreciate any suggestions please :slight_smile:

Are you using the same Auth code on both devices?
If yes, then you shouldn’t be.
You need different Auth codes and some Bridge code to get it working.

Pete.

Hi Pete, Thanks for the reply.
I’m using different auth codes already. For the bridge code I could only see examples for bridge code on Arduino and not for a Python script?

Not sure, I’ve never used Python.
What device are you running Python on?

Pete.

Not using a microcontroller device for Python just a PC which is running a machine vision algorithm on a live rtsp stream and outputting the variable on whether a person is present or not