-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMotorControl.h
More file actions
28 lines (22 loc) · 771 Bytes
/
Copy pathMotorControl.h
File metadata and controls
28 lines (22 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef MOTOR_CONTROL_H
#define MOTOR_CONTROL_H
#include <Arduino.h>
class MotorControl {
const int SERVO_MIN = 500;
const int SERVO_MAX = 2500;
const int PWM_TIMER_12_BIT = 12;
const int PWM_BASE_FREQ = 333;
const int PWM_LEFT_CHANNEL;
const int PWM_RIGHT_CHANNEL;
const int PWM_CAMERA_BASE_FREQ = 50;
const int CAMERA_SERVO_MIN = 700;
const int CAMERA_SERVO_MAX = 2200;
const int PWM_CAMERA_CHANNEL;
public:
MotorControl(int leftChannel, int rightChannel, int cameraChannel);
void begin(int leftPin, int rightPin, int cameraPin);
void update(double forwardVelocityCommand, double steeringVelocityCommand, double cameraPositionCommand);
private:
void ledcAnalogWrite(uint8_t channel, uint32_t value, uint32_t valueMax = 255);
};
#endif