Old working code

Dependencies:   mbed QEI ros_lib_melodic

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Motor.h Source File

Motor.h

00001 #include "mbed.h"
00002 #include <string>
00003 
00004 #include "QEI.h"
00005 
00006 class Motor{
00007     
00008 public:
00009     /** Constructor
00010     *   Create a motor object 
00011     *   
00012     *   @param in1 TB6612 IN1 pin number
00013     *   @param in2 TB6612 IN2 pin number
00014     *   @param pwm TB6612 PWM pin number
00015     */
00016     Motor(PinName in1, PinName in2, PinName pwm);
00017     
00018     /** Stop the motor
00019     *
00020     */
00021     void stop();  
00022     
00023     /** Set the speed
00024     *
00025     *   @param speed value to set
00026     */
00027     void setSpeed(float speed);
00028     
00029     
00030     void Motor::move(int in1, int in2);
00031 
00032 private:
00033     DigitalOut in1;
00034     DigitalOut in2;
00035     PwmOut pwm;
00036 };