A library that makes use of the TB6612FNG and tested on the Sparkfun FTB6612NG carrier board.

Dependents:   mbed-os-example-FinalReal mbed-os-example-FinalReal_copy mbed-os-example-FinalReal

Committer:
Pinski1
Date:
Thu Jun 09 17:43:46 2011 +0000
Revision:
1:7f18197d1210
Parent:
0:34d1ce434420
Removed an errant space in an attempt to get doxygen documentation to show up.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Pinski1 0:34d1ce434420 1 /* mBed FB6612FNG Library
Pinski1 0:34d1ce434420 2 *
Pinski1 0:34d1ce434420 3 * onerous copyright here
Pinski1 0:34d1ce434420 4 */
Pinski1 0:34d1ce434420 5
Pinski1 0:34d1ce434420 6 #ifndef MBED_TB6612FNG_H
Pinski1 0:34d1ce434420 7 #define MBED_TB6612FNG_H
Pinski1 0:34d1ce434420 8
Pinski1 0:34d1ce434420 9 #include "mbed.h"
Pinski1 0:34d1ce434420 10
Pinski1 0:34d1ce434420 11 /**
Pinski1 0:34d1ce434420 12 *
Pinski1 0:34d1ce434420 13 */
Pinski1 0:34d1ce434420 14 class TB6612FNG {
Pinski1 0:34d1ce434420 15 private:
Pinski1 0:34d1ce434420 16 PwmOut motorPWM;
Pinski1 0:34d1ce434420 17 DigitalOut In1;
Pinski1 0:34d1ce434420 18 DigitalOut In2;
Pinski1 0:34d1ce434420 19 public:
Pinski1 1:7f18197d1210 20
Pinski1 1:7f18197d1210 21 /** Creates a TB6612FNG object connected to the mbed.
Pinski1 1:7f18197d1210 22 * Note that for a full TB6612FNG 2 objects will need to be declaired and a DigitalOut to control the standby pin.
Pinski1 1:7f18197d1210 23 * @param pPWM
Pinski1 1:7f18197d1210 24 * @param pIn1
Pinski1 1:7f18197d1210 25 * @param pIn2
Pinski1 1:7f18197d1210 26 */
Pinski1 0:34d1ce434420 27 TB6612FNG(PinName pPWM, PinName pIn1, PinName pIn2);
Pinski1 1:7f18197d1210 28
Pinski1 1:7f18197d1210 29 /** Setting the speed
Pinski1 1:7f18197d1210 30 * @param newSpeed The new speed in the range -1.0 to +1.0
Pinski1 1:7f18197d1210 31 */
Pinski1 0:34d1ce434420 32 void setSpeed(float newSpeed);
Pinski1 0:34d1ce434420 33
Pinski1 1:7f18197d1210 34 /** Reading the speed
Pinski1 1:7f18197d1210 35 * @returns The speed in the range -1.0 to +1.0
Pinski1 1:7f18197d1210 36 */
Pinski1 1:7f18197d1210 37 float getSpeed(void);
Pinski1 0:34d1ce434420 38
Pinski1 1:7f18197d1210 39 /** Shorthand for the setSpeed and getSpeed functions */
Pinski1 1:7f18197d1210 40 void operator= (float param);
Pinski1 1:7f18197d1210 41 operator float();
Pinski1 0:34d1ce434420 42 };
Pinski1 0:34d1ce434420 43
Pinski1 0:34d1ce434420 44 #endif