Nicolae Marton / Mbed 2 deprecated TDP3_Final

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers L298_H.h Source File

L298_H.h

00001 #ifndef L298_H
00002 #define L298_H
00003 
00004 #include <mbed.h>
00005 
00006 //RobotControl is used to control the direction and speed of the robot
00007 //attributes : the pinouts of the enable and pwm forward and backwards
00008 //methods : SetSpeed and SetDirection to set speed and set direction
00009 
00010 class L298
00011 {
00012 private:
00013     
00014     DigitalOut m_motorBw;
00015     DigitalOut m_motorFw;
00016     PwmOut m_motorEnable;
00017     
00018     
00019     bool m_prevDir;
00020     
00021     
00022 public:
00023     
00024     bool m_dir;
00025     float m_speed;
00026     
00027     L298(PinName pin1, PinName pin2, PinName pin3); //initializes the pins, direction and speed
00028     
00029     void SetDirection(bool dir);        //sets direction of robot, forward or backwards
00030     void SetSpeed(float speed);         //sets speed of robot regardless of direction
00031     void Stop();
00032     
00033 };
00034 
00035 
00036 
00037 
00038 #endif