My GPG3 has a servo and a distance sensor. In testing these devices, I’ve been comparing the Bloxter code with the corresponding Bloxter-generated Python code, and I notice that you (i.e., Dexter Bloxter engineers) have introduced some deliberate latency into the Python code.
Specifically, after the distance sensor is initialized, you insert a 100 ms delay (“time.sleep(0.1)”). However, after the servo is initialized, no delay is inserted.
My Bloxter test code contains a continuous loop (“while my_Distance_portI2C.read_inches() < 9:”). Outside this loop, and before the loop is iterated, you insert a 50-ms delay (“time.sleep(0.05)”).
From these observations, I infer some rules for the would-be Python coder of a GPG3:
-
No wait is necessary after initializing a servo
-
Wait 100 ms after initializing the distance sensor before proceeding with the next step.
-
Wait 50 ms between queries to the distance sensor
I assume you’ve developed these, and other, rules empirically, and they’re necessary to make the GPG3 operate correctly. Have you codified them anywhere for the budding Python coder of the GPG3?