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.
motor.h
00001 #ifndef MOTOR_H 00002 #define MOTOR_H 00003 00004 #include "mbed.h" 00005 //#include "main.h" 00006 00007 #define BRAKE_VOLTAGE 0.2 00008 00009 /* 00010 extern PwmOut left1; 00011 extern PwmOut left2; 00012 extern PwmOut right1; 00013 extern PwmOut right2; 00014 00015 extern DigitalOut enableLeftMotor; 00016 extern DigitalOut enableRightMotor; */ 00017 00018 class Motor 00019 { 00020 public: 00021 Motor( PinName f, PinName b, PinName e ) : 00022 enableForw( f ), enableBack( b ), motorSpeed( e ), maxSpeed( 0.2 ), minSpeed(0.07) 00023 { 00024 } 00025 00026 void backward( double voltage ); 00027 void forward( double voltage ); 00028 void brake(); 00029 void coast(); 00030 void move( double voltage ); 00031 00032 private: 00033 DigitalOut enableForw; 00034 DigitalOut enableBack; 00035 PwmOut motorSpeed; 00036 const double maxSpeed; 00037 const double minSpeed; 00038 }; 00039 00040 //QEI leftWheel( 00041 00042 /* 00043 inline void enableMotors(){ 00044 enableLeftMotor.write(1); 00045 enableRightMotor.write(1); 00046 }*/ 00047 00048 00049 #endif
Generated on Tue Jul 12 2022 17:41:24 by
1.7.2