V1

Dependents:   VITI_motor_angle_1 VITI_motor_angle_2 VITI_motor_angle_3

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TB6549.h Source File

TB6549.h

00001 /* mbed simple H-bridge motor controller
00002  * Copyright (c) 
00003  
00004  */
00005  
00006 #ifndef MBED_MOTOR_H
00007 #define MBED_MOTOR_H
00008  
00009 #include "mbed.h"
00010  
00011 /** Interface to control a standard DC motor 
00012  *
00013  * with an H-bridge using a PwmOut and 3 DigitalOuts
00014  */
00015 class Motor {
00016 public:
00017  
00018     /** Create a motor control interface    
00019      *
00020      * @param pwm A PwmOut pin, driving the H-bridge enable line to control the speed
00021      * @param in1 A DigitalOut, 
00022      * @param in2 A DigitalOut, 
00023      * @param sb  
00024      A DigitalOut, 
00025      */
00026     Motor(PinName pwm, PinName in1, PinName in2, PinName sb);
00027     
00028     /** Set the speed of the motor
00029      * 
00030      * @param speed The speed of the motor as a normalised value between -1.0 and 1.0
00031      */
00032     void speed(float speed);
00033  
00034 protected:
00035     PwmOut _pwm;
00036     DigitalOut _in1;
00037     DigitalOut _in2;
00038     DigitalOut _sb;
00039  
00040 };
00041  
00042 #endif
00043