Closed chrissv closed 5 years ago
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.
Implemented. Please check the latest master, examples directory. Waiting for the feedback!
v0.2.0 is released and available via pip: https://github.com/vshymanskyy/blynk-library-python/releases/latest
Currently the callbacks for each pin must be declared individually and uniquely:
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):
This issue is to provide some mechanism to make the pin number available to the callback function.