19 ledc_timer_config_t motor_timer = {
24 .clk_cfg = LEDC_AUTO_CLK
26 ledc_timer_config(&motor_timer);
32 uint32_t runtime = (uint32_t)args;
38 if(runtime>40||runtime==0){
47 for(
int i = 0;i<fifocount;i++){
54 int difference = abs(leftCounter-rightCounter);
57 }
else if(difference>20){
59 }
else if(difference >15){
61 }
else if(difference > 10){
67 if(leftCounter>rightCounter){
70 }
else if(leftCounter<rightCounter){
109 uint32_t runtime = (uint32_t)args;
121 if((runtime>40)||(runtime==0)){
137 if (rotateForMs > 0){
149 uint32_t runtime = (uint32_t)args;
161 if(runtime>40||runtime==0){
This component controls the ability to rotate and change position.
uint getDataFromFIFO(FIFO_Package *buffer)
will read all availible packages from fifo, after 40ms Fifo is full
void begin(void)
initialized the IMU Component. Wakes the IMU from Standby Set configuration
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
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 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)
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.