Example for a Magnevation Board used previously on a OOPICII
Fork of Motordriver by
Interface to control a standard DC motor with an H-bridge using a PwmOut and 2 DigitalOuts Specifically for the Magnevation Board - refer to comments. More...
|Motor (PinName pwm, PinName fwdrev, PinName brake, bool direction, bool stop)|
|Create a motor control interface. |
|float||speed (float speed, bool fwdrev, bool stop)|
|Create Motor instance. |
|float||stop (float speed, bool stop)|
|Set the the motor to coast. |
|return the current state of the motor |
Interface to control a standard DC motor with an H-bridge using a PwmOut and 2 DigitalOuts Specifically for the Magnevation Board - refer to comments.
Constructor & Destructor Documentation
Create a motor control interface.
pwm,A PwmOut pin driving the H-bridge enable line to control the speed fwdrev,A DigitalOut pin note Forward and Reverse is relative to how you connect the motor(s) and Refer to Figure 4 pages 6 & 7 in Instrument LMD18200 data sheet. brake,A DigitalOut pin the Magnevation driver board is able to perform a brake i.e. 0 false brake ON, 1 true brake OFF.
Member Function Documentation
Create Motor instance.
Set the speed of the motor
speed The speed of the motor as a normalised value between 0.0 and 1.0. fwdrev Magnevation board sets direction on a pin so does not need -1.0 to 0.0. stop The Magnevation Board has a brake facility and incorporates the Current Limiting features of the LMD18200.
- the applied speed to the motor after checking to ensure motor doesn't switch from forward to reverse without stopping.
Set the the motor to coast.
In a practical world you would not neccessarily leave anything 'coasting' and acting as a dc generator always better to have a drive under control at all times so I haven't included this from the origanal class constructor for the Magnevation Board. Set the motor to dynamicaly brake
The Magnevation Board has a brake facility and incorporates the Current Limiting features of the LMD18200.
Generated on Tue Jul 19 2022 21:53:41 by 1.7.2