 |
Dezibot 4
|
Go to the documentation of this file.
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 // Set duty resolution to 13 bits
25 #define FREQUENCY (5000) // Frequency in Hertz. Set frequency at 5 kHz
26 #define DEFAULT_BASE_VALUE 3900
122 static void stop(
void);
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 void leftMotorTask(void *args)
static uint16_t RIGHT_MOTOR_DUTY
This component controls the IMU (Accelerometer & Gyroscope) ICM-42670-P.
#define DEFAULT_BASE_VALUE
static TaskHandle_t xMoveTaskHandle
static void stop(void)
stops any current movement, no matter if timebased or endless
static int correctionThreshold
void begin(void)
Initializes the motor.
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 FIFO_Package * buffer
uint16_t getSpeed(void)
returns the currently activ speed
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 void rightMotorTask(void *args)
static const int MOTOR_RIGHT_PIN
Motor(uint8_t pin, ledc_timer_t timer, ledc_channel_t channel)
static TickType_t xLastWakeTime
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,...
void setSpeed(uint16_t duty)
Set the Speed by changing the pwm. To avoid current peaks, a linear ramp-up is used.
static void moveTask(void *args)
static TaskHandle_t xAntiClockwiseTaskHandle
static TaskHandle_t xClockwiseTaskHandle
static uint16_t LEFT_MOTOR_DUTY
static const int MOTOR_LEFT_PIN
static MotionDetection detection
void begin(void)
Initialize the movement component.