This is a program to drive a stepper servomotor from SerialUSB without any other interrution but the serial one.
L293D Class Reference
Class to handle L293D in two modes, Pwm or Digital. More...
#include <L293D.h>
Public Member Functions | |
L293D (PwmOut pwmLeft, PwmOut right, DigitalOut left, DigitalOut right) | |
Two PWM for speed Cpntrol & two digital outs needed for setting direction on each side of the L293D. | |
void | setSpeedLeft (float speed) |
Set the left PWM to current speed and Direction. | |
void | setSpeedRight (float speed) |
Set the right PWM to current speed and direction. | |
float | getSpeedLeft () |
Read the left PWM current speed & direction Ranges from -1.0 to 1.0, as being set. | |
float | getSpeedRight () |
Read the left PWM current speed & direction. |
Detailed Description
Class to handle L293D in two modes, Pwm or Digital.
Pwm Mode requires constructing an object with two PwmOut'puts to handle Speed. Enable, or Digital Mode requires One DigitalOut'put to Enable or Disable both sides of the L293D driver.
This of course requires an 'special' wiring of the driver, using one transistor for each side. The transistor is effectively a NOT gate, assuring that the direction of the current of the driver output will be controlled using just one pin. _____________ Enable/ Pwm --->[1] _5V__ | L | _______________ [2] _|_ / | 2 | | | ---------[3] |1k| | | | 9 |__| | | (GND)[4] /_________/ ( ~ ) | 3 _left |/ | (GND)[5] -.---|470ohm|----|\ (Q 2N3904) | | | | \ | -------[6] D | |_(GND) | | | [7] | 5~15V-->[8]_____________
Hope you get my ASCII Art. same goes for the other side, thus allowing a complete control of the driver with a few pins.
Also for Sake of Simplicity SetSpeedLeft/Right will control Motor Speed and Direction, from -1.0 to 1.0 Reverse if < 0.
Definition at line 38 of file L293D.h.
Constructor & Destructor Documentation
L293D | ( | PwmOut | pwmLeft, |
PwmOut | right, | ||
DigitalOut | left, | ||
DigitalOut | right | ||
) |
Member Function Documentation
float getSpeedLeft | ( | ) |
float getSpeedRight | ( | ) |
void setSpeedLeft | ( | float | speed ) |
Generated on Mon Jul 25 2022 22:31:17 by 1.7.2