Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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
Generated on Sat Aug 6 2022 16:18:59 by
1.7.2