Servo Class

This class controls the pen-up and pen-down action of the robot. The class is designed for use with a standard hobby servo. It runs PWM at 50 Hz with pulse-widths between 80,000 \(\mu s\) and 120,000 \(\mu s\) to serve as the ‘up’ and ‘down’ positions.

class dcDriver.dcDriver(PWM_pin: pyb.Pin = pyb.Pin.cpu.A0, timer: int = 2, ch: int = 1)

Bases: object

Variables
  • PWM_pin (pyb.Pin) – Pin connected to the signal line for the servo.

  • timer (integer) – The timer number to be used for PWM. Set to Timer 2 by default.

  • ch (integer) – Channel number to be used for PWM. Set to Channel 1 by default.

down()

Sets the pen to the ‘down’ position.

toggle()

Toggles the pen between ‘up’ and ‘down’ positions.

up()

Sets the pen to the ‘up’ position.