blynk-library-python icon indicating copy to clipboard operation
blynk-library-python copied to clipboard

'Blynk' object has no attribute 'VIRTUAL_WRITE' on a raspberry pi pico w

Open mas6y6 opened this issue 1 year ago • 3 comments

I have an issue that the function 'VIRTUAL_WRITE' was not found and VIRTUAL_READ is broken for micropython

Here is the code

import BlynkLib
import connecttowifi
connecttowifi.connect()
AUTH_TOKEN = "*"
# Initialize Blynk
blynk = BlynkLib.Blynk(AUTH_TOKEN)

@blynk.VIRTUAL_WRITE(3)
def v3_write_handler(value):
    # execute the command echo it back
    blynk.virtual_write(3, 'Command: ' + value + '\n')
    blynk.virtual_write(3, 'Result: ')
    try:
        blynk.virtual_write(3, str(eval(value)))
    except:
        try:
            exec(value)
        except Exception as e:
            blynk.virtual_write(3, 'Exception:\n  ' + repr(e))
    finally:
        blynk.virtual_write(3, '\n')

while True:
    blynk.run()

mas6y6 avatar Jul 27 '23 04:07 mas6y6

Maybe you're using the wrong library? Which version are you using? (https://github.com/vshymanskyy/blynk-library-python/tree/master)

ebolisa avatar Jul 27 '23 05:07 ebolisa

I am using the latest version

mas6y6 avatar Jul 27 '23 15:07 mas6y6

try using this example https://github.com/vshymanskyy/blynk-library-python/blob/master/examples/02_on_virtual_change.py#L33

ssplatt avatar Aug 03 '23 18:08 ssplatt