metered_motors
– adds encoder feedback to the original botcore.Motors
class¶
Module metered_motors
Contains the MeteredMotors
class which adds encoder feedback to the
original botcore.Motors
class. This is a building block towards being able
to tell how fast you are going, or how far you have gone.
-
class
metered_motors.
MeteredMotors
(motors, leds)[source]¶ A wrapper class for the existing Motor class that adds support for making use of the two optical encoders too. Notice that it mimics the API of the
botcore.Motors
class, and then extends it.-
enable
(do_enable)[source]¶ Enabling the motors allows them to move, disabling them stops them from spinning.
- Parameters
do_enable (bool) – true to enable, false to disable
-
get_and_reset_ticks
()[source]¶ Get the current tick counts as a (left, right) tuple, and restart the counters.
-
get_ticks
()[source]¶ Get the current tick counts as a (left, right) tuple.
Does not reset the tick counters.
-
left_encoder_handler
(timer_is_unused)[source]¶ Interrupt handler for the left encoder wheel. You don’t call this.
-
right_encoder_handler
(timer_is_unused)[source]¶ Interrupt handler for the right encoder wheel. You don’t call this.
-