-
While using telemetrix-aio, I am finding that it takes an extremely long time for my callbacks to respond after a pin's output changes. To illustrate, I have combined blink.py with digital.py to get the following (cut out copyright and function comments for readability):
Output of after running my code (cut out copyright and connection messages for readability):
Output of after stepping through my code (slowly stepping through a break point in the callback):
As you can see in the first output, running the code (even with a 1 second delay on blink) was fast enough that it never got a chance for the callback to return. Is this expected behavior? And if so, what is the right way to write something that will do a blocking read and blocking write? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I may be misunderstanding the intent of the code, so let me state what I believe it is doing. Please correct me if I am misunderstanding.
A digital pin can be either an input or an output, but not both simultaneously. The digital_in function establishes the pin as an input, then blink sets it as an output. I am not sure why you are getting callbacks at all since Telemetrix4Arduino triggers off of the pin's current mode. Only if the pin is a digital input (which it no longer is), can a report be generated. Please let me know if this answers your question. |
Beta Was this translation helpful? Give feedback.
-
@Delta0001 Please be aware that most Arduino boards have limited buffer space for serial communication, and Arduinos do not support flow control. Some commands may get lost if you rapidly send many commands that fill up the Arduino's buffer. The remedy, in that case, is to put a short delay between sending the commands. |
Beta Was this translation helpful? Give feedback.
I may be misunderstanding the intent of the code, so let me state what I believe it is doing. Please correct me if I am misunderstanding.
A digital pin can be either an input or an output, but not both simultaneously. The digital_in function establishes the pin as an input, then blink sets it as an output.
I am not sure why you are getting callbacks at all since Telemetrix4Arduino triggers off of the pin's current mode. Only if the pin is a digital input (which it no longer is), can a report be generated.
Pl…