arduino stuffs
Diffstat (limited to 'car_driver/arduino/motor_utils.h')
| -rw-r--r-- | car_driver/arduino/motor_utils.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/car_driver/arduino/motor_utils.h b/car_driver/arduino/motor_utils.h index fea6441..cb40b1b 100644 --- a/car_driver/arduino/motor_utils.h +++ b/car_driver/arduino/motor_utils.h @@ -4,13 +4,14 @@ namespace motor_utils { // @param direction LOW is backwards, HIGH is forward // @param speed 0-255 -inline void set(int motor, int brake, int speed_pin, int direction, int speed) { - digitalWrite(motor, direction); - digitalWrite(brake, LOW); // brake off +inline void set(uint8_t motor_pin, uint8_t brake_pin, uint8_t speed_pin, + int8_t direction, uint8_t speed) { + digitalWrite(motor_pin, direction); + digitalWrite(brake_pin, LOW); // brake off analogWrite(speed_pin, speed); // speed up } -inline void brake(int brake_pin, int speed_pin) { +inline void brake(uint8_t brake_pin, uint8_t speed_pin) { digitalWrite(brake_pin, HIGH); // engage brake analogWrite(speed_pin, 0); // slow } |