Provide virtual pin number to callback function
chrissv opened this issue · comments
chrissv commented
Currently the callbacks for each pin must be declared individually and uniquely:
@blynk.VIRTUAL_READ(2)
def v2_read_handler():
print "This is V2 handler"
@blynk.VIRTUAL_READ(3)
def v3_read_handler():
print "This is V3 handler"
But there are cases where I want to call a common function, passing in the pin. Something like this (not real code, but the concept):
@blynk.VIRTUAL_READ(2)
def v2_read_handler():
common_handler(pin)
@blynk.VIRTUAL_READ(3)
def v3_read_handler():
common_handler(pin)
def common_handler(pin):
print "This is V{} handler" % pin
This issue is to provide some mechanism to make the pin number available to the callback function.
Volodymyr Shymanskyy commented
Implemented. Please check the latest master, examples directory.
Waiting for the feedback!
Volodymyr Shymanskyy commented
v0.2.0 is released and available via pip:
https://github.com/vshymanskyy/blynk-library-python/releases/latest