mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-21 20:11:46 +02:00
46 lines
956 B
C++
46 lines
956 B
C++
/**
|
|
* @file Motion.cpp
|
|
* @author Jonathan Schulze, Nick Hübenthal
|
|
* @brief Implementation of the Motion class.
|
|
* @version 0.1
|
|
* @date 2023-12-13
|
|
*
|
|
* @copyright Copyright (c) 2023
|
|
*
|
|
*/
|
|
|
|
#include "Motion.h"
|
|
|
|
// Constructor
|
|
Motion::Motion() {
|
|
|
|
}
|
|
|
|
// Initialize the movement component.
|
|
void Motion::begin(void) {
|
|
|
|
}
|
|
void moveTask(void * moveForMs) {
|
|
analogWrite(MOTOR_LEFT_PIN, 128);
|
|
analogWrite(MOTOR_RIGHT_PIN, 128);
|
|
vTaskDelay((uint32_t) moveForMs);
|
|
analogWrite(MOTOR_LEFT_PIN, 0);
|
|
analogWrite(MOTOR_RIGHT_PIN, 0);
|
|
}
|
|
|
|
// Move forward for a certain amount of time.
|
|
void Motion::move(uint32_t moveForMs) {
|
|
xTaskCreate(moveTask, "Move", configMINIMAL_STACK_SIZE, (void*)moveForMs, 1, NULL);
|
|
}
|
|
|
|
|
|
// Rotate clockwise for a certain amount of time.
|
|
void Motion::rotateClockwise(uint32_t rotateForMs) {
|
|
|
|
}
|
|
|
|
// Rotate anticlockwise for a certain amount of time.
|
|
void Motion::rotateAnticlockwise(uint32_t rotateForMs) {
|
|
|
|
}
|