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;
39 if(runtime>40||runtime==0){
48 for(
int i = 0;i<fifocount;i++){
55 int difference = abs(leftCounter-rightCounter);
58 }
else if(difference>20){
60 }
else if(difference >15){
62 }
else if(difference > 10){
68 if(leftCounter>rightCounter){
71 }
else if(leftCounter<rightCounter){
111 uint32_t runtime = (uint32_t)args;
123 if((runtime>40)||(runtime==0)){
139 if (rotateForMs > 0){
151 uint32_t runtime = (uint32_t)args;
163 if(runtime>40||runtime==0){
This component controls the ability to rotate and change position.
void stopFIFO(void)
stops writing results to FIFO-Storage needs to be called before Data Registers (such as GYRO_DATA_*,...
uint getDataFromFIFO(FIFO_Package *buffer)
will read all availible packages from fifo, after 40ms Fifo is full Only works when startFIFO was cal...
void startFIFO(void)
starts writing the measurment results to the FIFO-Storage
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.