V1

Dependents:   VITI_motor_angle_1 VITI_motor_angle_2 VITI_motor_angle_3

TB6549.h

Committer:
gr66
Date:
2020-05-21
Revision:
0:1b8889c40a44

File content as of revision 0:1b8889c40a44:

/* mbed simple H-bridge motor controller
 * Copyright (c) 
 
 */
 
#ifndef MBED_MOTOR_H
#define MBED_MOTOR_H
 
#include "mbed.h"
 
/** Interface to control a standard DC motor 
 *
 * with an H-bridge using a PwmOut and 3 DigitalOuts
 */
class Motor {
public:
 
    /** Create a motor control interface    
     *
     * @param pwm A PwmOut pin, driving the H-bridge enable line to control the speed
     * @param in1 A DigitalOut, 
     * @param in2 A DigitalOut, 
     * @param sb  
     A DigitalOut, 
     */
    Motor(PinName pwm, PinName in1, PinName in2, PinName sb);
    
    /** Set the speed of the motor
     * 
     * @param speed The speed of the motor as a normalised value between -1.0 and 1.0
     */
    void speed(float speed);
 
protected:
    PwmOut _pwm;
    DigitalOut _in1;
    DigitalOut _in2;
    DigitalOut _sb;
 
};
 
#endif