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.
Dependencies: mbed HC_SR04_Ultrasonic_Library
RobotControl_H.h
00001 #ifndef RobotControl_H 00002 #define RobotControl_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 RobotControl 00011 { 00012 private: 00013 00014 DigitalOut m_motorEnable; 00015 PwmOut m_motorBw; 00016 PwmOut m_motorFw; 00017 PwmOut* m_pwmPtr; 00018 00019 bool m_prevDir; 00020 00021 00022 public: 00023 00024 bool m_dir; 00025 float m_speed; 00026 00027 RobotControl(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 00032 }; 00033 00034 00035 00036 00037 #endif
Generated on Sat Jul 16 2022 14:00:16 by
 1.7.2
 1.7.2