Same as mallet... but distance

Dependencies:   EthernetInterface NetworkAPI mbed-rtos mbed

Fork of MalletFirmware by Impact-Echo

Committer:
willange
Date:
Tue Dec 09 17:37:12 2014 +0000
Revision:
30:1da0bb9c31a6
Parent:
28:4a833d59897b
a basic timer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
timmey9 22:523e316cbe70 1 #ifndef MOTOR_CONTROL_H
timmey9 22:523e316cbe70 2 #define MOTOR_CONTROL_H
timmey9 22:523e316cbe70 3
timmey9 22:523e316cbe70 4 #include "mbed.h"
timmey9 22:523e316cbe70 5
timmey9 28:4a833d59897b 6 #define CHECK_TIME 50 // Check every 50us to make sure both sides of the h bridge aren't ON at the same time
timmey9 22:523e316cbe70 7
timmey9 22:523e316cbe70 8 class MotorControl {
timmey9 22:523e316cbe70 9 public:
timmey9 22:523e316cbe70 10 MotorControl(PinName forward, PinName backward, int period, int safetyPeriod);
timmey9 22:523e316cbe70 11 void forward(float, uint32_t);
timmey9 22:523e316cbe70 12 void backward(float, uint32_t);
timmey9 22:523e316cbe70 13 void forward(int);
timmey9 22:523e316cbe70 14 void backward(int);
timmey9 22:523e316cbe70 15
timmey9 22:523e316cbe70 16 private:
timmey9 22:523e316cbe70 17 bool _invert; // used to change the polarity of the motors (i.e. what is considered forward/backward)
timmey9 22:523e316cbe70 18 DigitalOut _forward;
timmey9 22:523e316cbe70 19 DigitalOut _backward;
timmey9 22:523e316cbe70 20 int _period;
timmey9 22:523e316cbe70 21 int _safetyPeriod;
timmey9 22:523e316cbe70 22 };
timmey9 22:523e316cbe70 23
timmey9 22:523e316cbe70 24 #endif