Python Forum

Full Version: Can't read virtual pin or use notification on blynk
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Using the github bylnkkk for raspberry pi 3 (via ethernet) on python3 (https://github.com/blynkkk/lib-python), (0.2.6) it connects okay (using blynk server) and I can set the value of a virtual pin, but I just can't figure
out how to read the value of one or use an interrupt / thread / function to run when its state is changed.
Writing 1 to virtual pin 4 works:
blynk.virtual_write(4, 1)
but neither of these work: (I don't get anything printed when I change the state of V4)
@blynk.handle_event('read V4')
def read_virtual_pin_handler(pin):
    print("po")
    #print(READ_PRINT_MSG.format(pin))
    #print(blynk.virtual_sync(pin))
    #print(sensor_data)
    blynk.notify('Warning critical value')
    #blynk.virtual_write(pin, random.randint(0, 255))
  
@blynk.handle_event('write V4')
def write_virtual_pin_handler(pin, value):
    print(WRITE_EVENT_PRINT_MSG.format(pin, value))
    blynk.notify('bpush') 
Any ideas how I can use python & blynk with my pi? Thanks
Hi...Blynk application has backing of numerous gadgets. That implies you can allocate any gadget to explicit gadget with own auth token. For instance - you might have button on V1 that controls wi-fi bulb An and one more button on V1 that controls wi-fi bulb B. To do this you wanted more than 1 gadget inside your venture. To accomplish this if it's not too much trouble, go to project settings and snap on "Gadgets" area :