Motor

Background: PWM and GPIO Usage

../_images/motor-control-btn9960lv-one-pwm-two-gpio1.jpg

Todo

Motor

Background: PWM and GPIO Usage

Explain meaning of pins forward/backward/speed

Class Description

Todo

Motor

Class Description

Note that the SysFS_Motor class does not expose how the motor control works - it shouldn’t. Rather, it has only one method, set_speed(percentage_of_max_speed).

Depending on the parameter’s value, IOs and PWM are tuned accordingly. Give examples (here in Sphinx/RST, not in code/doxygen) so the user can understand how set_speed() is implemented in terms of SysFS_Motor’s forward, backward and speed ctor params.

class SysFS_Motor

Motor driver on top of GPIO and PWM

blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah

Public Functions

inline SysFS_Motor(SysFS_GPIO_Pin forward, SysFS_GPIO_Pin backward, SysFS_PWM_Pin speed)

Constructor

Parameters:
  • forward – blah blah blah blah blah blah

  • backward – blah blah blah blah blah blah

  • speed – blah blah blah blah blah blah

void set_speed(int percentage_of_max_speed)

Set speed

explain unit of percentage_of_max_speed

Parameters:

percentage_of_max_speed – blah blah blah blah blah blah

Future

Todo

Motor

Future

  • How about pulling the brake? How would that work? What’s the difference between a hard brake and set_speed(0)?

  • Overcurrent detection? How would one make use of an ADC to implement this?