15#include "freertos/FreeRTOS.h"
16#include "freertos/task.h"
17#include "driver/mcpwm.h"
19#define SERVO_PWM_UNIT (mcpwm_unit_t)MCPWM_UNIT_0
20#define SERVO_PWM_SIGNAL (mcpwm_io_signals_t)(MCPWM0A)
23#define SERVO_TIMER (mcpwm_timer_t)MCPWM_TIMER_0
25#define SERVO_MIN_PULSEWIDTH_US (1000)
26#define SERVO_MAX_PULSEWIDTH_US (2000)
27#define SERVO_MAX_DEGREE (90)
void startServo(Servo *servo)
startServo will start the time of the mcpwm
Definition: servo.c:69
void haltServo(Servo *servo)
haltServo will stop the timer of the mcpwm
Definition: servo.c:60
void moveServo(Servo *servo, int angle)
moveServo will move the servo motor by angles
Definition: servo.c:28
void servoInit(Servo *servo)
servoInit will initialize servo motor
Definition: servo.c:39
Servo struct for SG90 servo motor.
Definition: servo.h:49
int angle
Definition: servo.h:54
mcpwm_unit_t pwmUnit
Definition: servo.h:51
gpio_num_t gpio
Definition: servo.h:53
mcpwm_io_signals_t signal
Definition: servo.h:52
mcpwm_timer_t timerNum
Definition: servo.h:50