Refactoring Ironcup 2020

Dependencies:   mbed mbed-rtos MotionSensor EthernetInterface

Committer:
starling
Date:
Mon Sep 21 21:42:07 2020 +0000
Revision:
0:8f5db5085df7
12 mar 2020

Who changed what in which revision?

UserRevisionLine numberNew contents of line
starling 0:8f5db5085df7 1 #ifndef MOTOR_HEADER
starling 0:8f5db5085df7 2 #define MOTOR_HEADER
starling 0:8f5db5085df7 3
starling 0:8f5db5085df7 4 #include "mbed.h"
starling 0:8f5db5085df7 5 #include "CarPWM.h"
starling 0:8f5db5085df7 6
starling 0:8f5db5085df7 7 class Motor{
starling 0:8f5db5085df7 8
starling 0:8f5db5085df7 9 protected:
starling 0:8f5db5085df7 10 Ticker interruption;
starling 0:8f5db5085df7 11 bool alternate_motor;
starling 0:8f5db5085df7 12 float velocity;
starling 0:8f5db5085df7 13 float jog_duty_cycle;
starling 0:8f5db5085df7 14 float jog_period;
starling 0:8f5db5085df7 15 PwmOut motor;
starling 0:8f5db5085df7 16
starling 0:8f5db5085df7 17 public:
starling 0:8f5db5085df7 18
starling 0:8f5db5085df7 19 void startJogging(float jog_dc, float jog_p);
starling 0:8f5db5085df7 20 void stopJogging(void);
starling 0:8f5db5085df7 21 void brakeMotor(float brake_intensity, float brake_wait);
starling 0:8f5db5085df7 22 void reverseMotor(int speed);
starling 0:8f5db5085df7 23 void setVelocity(int new_velocity);
starling 0:8f5db5085df7 24 float getVelocity();
starling 0:8f5db5085df7 25 void setSmoothVelocity(int new_velocity);
starling 0:8f5db5085df7 26 Motor(PinName motor_pin);
starling 0:8f5db5085df7 27
starling 0:8f5db5085df7 28 private:
starling 0:8f5db5085df7 29 void motorJogging(void);
starling 0:8f5db5085df7 30
starling 0:8f5db5085df7 31 };
starling 0:8f5db5085df7 32 #endif