Library for H-Bridge Motor Driver Using Bipolar Transistors
motorlib.h
- Committer:
- prabhuvd
- Date:
- 2013-01-15
- Revision:
- 1:b690c5eb9469
- Parent:
- 0:155daae8a9fa
- Child:
- 2:c1f9f9d74f35
File content as of revision 1:b690c5eb9469:
/*mbed motorlib Library for H-Bridge Motor Driver Using Bipolar Transistors * * mbed simple H-bridge motor controller * Copyright (c) 2007-2012, Prabhu Desai * */ #ifndef MBED_MOTOR_H #define MBED_MOTOR_H #include "mbed.h" /** Interface to control a standard DC motor * */ class Motor { public: /** Create a motor control interface * * @param r1 DigitalOut, driving H-bridge NPN transistor on the BOTTOm right * @param r2 DigitalOut, driving H-bridge PNP transistor on the TOP right * @param r3 DigitalOut, driving H-bridge NPN transistor on the BOTTOm left. * @param r4 DigitalOut, driving H-bridge PNP transistor on the TOP left */ Motor(PinName r1, PinName r2, PinName r3, PinName r4); /** Set the motor to coast/roll/off * * @param void * @return void */ void coast(void); /** Rotate motor in clockwise direction. * * @param void * @return void */ void forward(void); /** /** Rotate motor in Anti-clockwise direction. * * @param void * @return void */ void backward(void); /** Stop the motor. * * @param void * @return void */ void stop(void); protected: DigitalOut _r1; DigitalOut _r2; DigitalOut _r3; DigitalOut _r4; }; #endif