TB6612FNG.Motor (tb6612fng v0.1.0)
Controls a motor attached to the TB6612FNG. Has a number of required settings:
in01_pin- A GPIO pin number for the first input pin for this motorin02_pin- A GPIO pin number for the second input pin for this motorpwm_pin- A GPIO pin number for the PWM pin for this motor. Must be a hardware PWM pin.name- A unique atom that will be used as both the ID and name of the GenServer controlling this motor. Used to control the motor from elsewhere.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Return the config for the motor, mostly for troubleshooting purposes or running manual commands using the GPIO references.
Set the direction of rotation and output for the motor specified.
Short brake the motor. This sets the output to 0.
Stop the motor. This leaves the PWM pin set at the current rate but sets both input pins low.
Link to this section Functions
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor.
get_config(name)
Return the config for the motor, mostly for troubleshooting purposes or running manual commands using the GPIO references.
set_output(name, direction, output)
Set the direction of rotation and output for the motor specified.
Accepts three parameters:
name- The name (atom) of the GenServer controlling the motor.direction- Either:cwfor clockwise or:ccwfor counter-clockwise rotationoutput- The PWM output requested. This should be an integer value between 0 and 1_000_000
short_brake(name)
Short brake the motor. This sets the output to 0.
start_link(opts)
stop(name)
Stop the motor. This leaves the PWM pin set at the current rate but sets both input pins low.