Using these devices requires us to count pulses. In this section, we will create some code to turn on the motors, and count pulses for a while. This will validate that the sensors are connected correctly. We will then take this code and make it part of the robot class as a behavior.
Detecting the distance traveled in Python
Simple counting
This code will count the number of cycles up and down on the signal pin for each wheel, and print them as we go to test the sensors. We will run our motors for about 1 second.
The following code can be found in GitHub under Chapter 12 as test_encoders.py (https://github.com/PacktPublishing/Learn-Robotics-Fundamentals-of-Robotics-Programming/blob/master/chapter12/test_encoders.py).
Let&apos...