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

TB6612FNG.h

Committer:
Pinski1
Date:
2011-05-30
Revision:
0:34d1ce434420
Child:
1:7f18197d1210

File content as of revision 0:34d1ce434420:

/* mBed FB6612FNG Library 
 *
 * onerous copyright here
 */

#ifndef MBED_TB6612FNG_H
#define MBED_TB6612FNG_H

#include "mbed.h"

/** 
 *
 */

class TB6612FNG {
    private:
        PwmOut motorPWM;
        DigitalOut In1;
        DigitalOut In2; 
    public:
	
		/** Creates a TB6612FNG object connected to the mbed.
		 * Note that for a full TB6612FNG 2 objects will need to be declaired and a DigitalOut to control the standby pin.
		 * @param pPWM
		 * @param pIn1
		 * @param pIn2
		 */
        TB6612FNG(PinName pPWM, PinName pIn1, PinName pIn2);       
		
		/** Setting the speed
		 * @param newSpeed The new speed in the range -1.0 to +1.0
		 */
        void setSpeed(float newSpeed);        
        
		/** Reading the speed
		 * @returns The speed in the range -1.0 to +1.0
		 */
		float getSpeed(void);
        
		/** Shorthand for the setSpeed and getSpeed functions */
		void operator= (float param);        
		operator float();        
};

#endif