Replies: 1 comment 1 reply
-
A >>> robot = Robot((2, 3), (4, 5))
>>> left, right = robot
>>> left
<gpiozero.Motor object containing 2 devices: forward_device, backward_device> A Motor is made up of two >>> f, b = left
>>> f
<gpiozero.PWMOutputDevice object on pin GPIO2, active_high=True, is_active=False> Each output device controls a pin. Frequency is set at the pin level, but in the context of a composite device, it only makes sense to control the collection of pins as a group. In gpiozero, the low-level concepts of pin control are abstracted from the user in place of actions which make sense at the device level. So to answer your question, it really depends what you are trying to achieve. Are you trying to control the speed of the motors? If so, just use the robot.forward(speed=0.5) https://gpiozero.readthedocs.io/en/stable/api_boards.html#gpiozero.Robot.forward |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey all,
we are a group of three students developing a robot for our master thesis at the IT University of Copenhagen in Denmark. We discovered gpiozero a few weeks ago, and it has been of tremendous help! However, we have problems getting access to change the PWM frequency of the PWMOutputDevice instance that is constructed whenever pwm is set to True when creating a Robot object. Is there any way to get access to changing the frequency?
Beta Was this translation helpful? Give feedback.
All reactions