16#include <freertos/FreeRTOS.h>
17#include <freertos/task.h>
18#include "driver/ledc.h"
20#define LEDC_MODE LEDC_LOW_SPEED_MODE
21#define TIMER LEDC_TIMER_2
22#define CHANNEL_LEFT LEDC_CHANNEL_3
23#define CHANNEL_RIGHT LEDC_CHANNEL_4
24#define DUTY_RES LEDC_TIMER_13_BIT
25#define FREQUENCY (5000)
26#define DEFAULT_BASE_VALUE 3900
122 static void stop(
void);
#define DEFAULT_BASE_VALUE
This component controls the IMU (Accelerometer & Gyroscope) ICM-42670-P.
static TickType_t xLastWakeTime
static void rotateAntiClockwise(uint32_t rotateForMs=0, uint baseValue=DEFAULT_BASE_VALUE)
Rotate anticlockwise for a certain amount of time. Call with moveForMs 0 will start movement,...
static uint16_t RIGHT_MOTOR_DUTY
static const int MOTOR_LEFT_PIN
static const int MOTOR_RIGHT_PIN
void begin(void)
Initialize the movement component.
static int correctionThreshold
static void leftMotorTask(void *args)
static void stop(void)
stops any current movement, no matter if timebased or endless
static void rightMotorTask(void *args)
static FIFO_Package * buffer
static MotionDetection detection
static void move(uint32_t moveForMs=0, uint baseValue=DEFAULT_BASE_VALUE)
Move forward for a certain amount of time. Call with moveForMs 0 will start movement,...
static TaskHandle_t xAntiClockwiseTaskHandle
static void moveWithoutCorrection(uint32_t moveForMs=0, uint baseValue=DEFAULT_BASE_VALUE)
Does the same as the move function, but this function does not apply any kind of algorithm to improve...
static TaskHandle_t xMoveTaskHandle
static uint16_t LEFT_MOTOR_DUTY
static void rotateClockwise(uint32_t rotateForMs=0, uint baseValue=DEFAULT_BASE_VALUE)
Rotate clockwise for a certain amount of time. Call with moveForMs 0 will start movement,...
static TaskHandle_t xClockwiseTaskHandle
static void moveTask(void *args)
uint16_t getSpeed(void)
returns the currently activ speed
Motor(uint8_t pin, ledc_timer_t timer, ledc_channel_t channel)
void begin(void)
Initializes the motor.
void setSpeed(uint16_t duty)
Set the Speed by changing the pwm. To avoid current peaks, a linear ramp-up is used.