first basic but working version of fiend a friend

This commit is contained in:
hhaupt 2024-04-28 23:11:08 +02:00
parent 53ba11839f
commit 9314683201

View File

@ -1,7 +1,7 @@
#include "Dezibot.h"
Dezibot dezibot = Dezibot();
const int centeredThreshold = 100;
const int centeredThreshold = 50 ;
void setup() {
// put your setup code here, to run once:
@ -17,29 +17,29 @@ void loop() {
//correct Stearing to be centered
if( abs(leftValue-rightValue)
< centeredThreshold){
dezibot.motion.move(1);
dezibot.motion.move();
}else{
if (leftValue > rightValue){
dezibot.motion.rotateAnticlockwise(1);
dezibot.motion.rotateAntiClockwise();
} else{
dezibot.motion.rotateClockwise(1);
dezibot.motion.rotateClockwise();
}
}
dezibot.multiColorLight.setTopLeds(BLUE);
break;
case IR_LEFT:
dezibot.motion.rotateAnticlockwise(1);
dezibot.motion.rotateAntiClockwise();
dezibot.multiColorLight.setTopLeds(RED);
break;
case IR_RIGHT:
dezibot.motion.rotateClockwise(1);
dezibot.motion.rotateClockwise();
dezibot.multiColorLight.setTopLeds(GREEN);
break;
case IR_BACK:
if(leftValue > rightValue){
dezibot.motion.rotateAnticlockwise(1);
dezibot.motion.rotateAntiClockwise();
} else {
dezibot.motion.rotateClockwise(1);
dezibot.motion.rotateClockwise();
}
dezibot.multiColorLight.setTopLeds(YELLOW);
break;