mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-07-04 01:31:41 +02:00
FIxes
This commit is contained in:
@ -9,7 +9,7 @@ Dezibot::Dezibot() : multiColorLight() {};
|
|||||||
|
|
||||||
void Dezibot::begin(void)
|
void Dezibot::begin(void)
|
||||||
{
|
{
|
||||||
Power.begin();
|
power.begin();
|
||||||
Wire.begin(SDA_PIN, SCL_PIN);
|
Wire.begin(SDA_PIN, SCL_PIN);
|
||||||
infraredLight.begin();
|
infraredLight.begin();
|
||||||
lightDetection.begin();
|
lightDetection.begin();
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include "Motion.h"
|
#include "Motion.h"
|
||||||
|
#include "power/Power.h"
|
||||||
|
|
||||||
Motor::Motor(uint8_t pin, ledc_timer_t timer, ledc_channel_t channel){
|
Motor::Motor(uint8_t pin, ledc_timer_t timer, ledc_channel_t channel){
|
||||||
this->pin = pin;
|
this->pin = pin;
|
||||||
this->channel = channel;
|
this->channel = channel;
|
||||||
this->timer = timer;
|
this->timer = timer;
|
||||||
this->duty = 0;
|
this->duty = 0;
|
||||||
this->powerManager =
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void Motor::begin(void){
|
void Motor::begin(void){
|
||||||
@ -24,13 +24,6 @@ void Motor::begin(void){
|
|||||||
};
|
};
|
||||||
|
|
||||||
void Motor::setSpeed(uint16_t duty){
|
void Motor::setSpeed(uint16_t duty){
|
||||||
if(duty>0) {
|
|
||||||
powerManager->waitForPowerAllowance(CONSUMPTION_MOTOR, portMAX_DELAY);
|
|
||||||
Serial.println("Motor got power");
|
|
||||||
} else {
|
|
||||||
powerManager->releasePower(CONSUMPTION_MOTOR);
|
|
||||||
Serial.println("Motor released power");
|
|
||||||
}
|
|
||||||
int difference = duty-this->getSpeed();
|
int difference = duty-this->getSpeed();
|
||||||
if (difference > 0){
|
if (difference > 0){
|
||||||
for(int i = 0;i<difference;i+=difference/20){
|
for(int i = 0;i<difference;i+=difference/20){
|
||||||
|
Reference in New Issue
Block a user