mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-21 20:11:46 +02:00
first basic but working version of fiend a friend
This commit is contained in:
parent
53ba11839f
commit
9314683201
@ -1,7 +1,7 @@
|
|||||||
#include "Dezibot.h"
|
#include "Dezibot.h"
|
||||||
|
|
||||||
Dezibot dezibot = Dezibot();
|
Dezibot dezibot = Dezibot();
|
||||||
const int centeredThreshold = 100;
|
const int centeredThreshold = 50 ;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// put your setup code here, to run once:
|
// put your setup code here, to run once:
|
||||||
@ -17,29 +17,29 @@ void loop() {
|
|||||||
//correct Stearing to be centered
|
//correct Stearing to be centered
|
||||||
if( abs(leftValue-rightValue)
|
if( abs(leftValue-rightValue)
|
||||||
< centeredThreshold){
|
< centeredThreshold){
|
||||||
dezibot.motion.move(1);
|
dezibot.motion.move();
|
||||||
}else{
|
}else{
|
||||||
if (leftValue > rightValue){
|
if (leftValue > rightValue){
|
||||||
dezibot.motion.rotateAnticlockwise(1);
|
dezibot.motion.rotateAntiClockwise();
|
||||||
} else{
|
} else{
|
||||||
dezibot.motion.rotateClockwise(1);
|
dezibot.motion.rotateClockwise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dezibot.multiColorLight.setTopLeds(BLUE);
|
dezibot.multiColorLight.setTopLeds(BLUE);
|
||||||
break;
|
break;
|
||||||
case IR_LEFT:
|
case IR_LEFT:
|
||||||
dezibot.motion.rotateAnticlockwise(1);
|
dezibot.motion.rotateAntiClockwise();
|
||||||
dezibot.multiColorLight.setTopLeds(RED);
|
dezibot.multiColorLight.setTopLeds(RED);
|
||||||
break;
|
break;
|
||||||
case IR_RIGHT:
|
case IR_RIGHT:
|
||||||
dezibot.motion.rotateClockwise(1);
|
dezibot.motion.rotateClockwise();
|
||||||
dezibot.multiColorLight.setTopLeds(GREEN);
|
dezibot.multiColorLight.setTopLeds(GREEN);
|
||||||
break;
|
break;
|
||||||
case IR_BACK:
|
case IR_BACK:
|
||||||
if(leftValue > rightValue){
|
if(leftValue > rightValue){
|
||||||
dezibot.motion.rotateAnticlockwise(1);
|
dezibot.motion.rotateAntiClockwise();
|
||||||
} else {
|
} else {
|
||||||
dezibot.motion.rotateClockwise(1);
|
dezibot.motion.rotateClockwise();
|
||||||
}
|
}
|
||||||
dezibot.multiColorLight.setTopLeds(YELLOW);
|
dezibot.multiColorLight.setTopLeds(YELLOW);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user