Ein Roboter mit bürstenlosem Antrieb, differenzial und NRF24L01 Funk. Großflächig gebaut um ein großes Solarpanel aufzunehmen. https://gitlab.informatik.hs-fulda.de/fdai5253/roboter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.5 KiB

void manualDigitalDrive() {
bool goOn = false;
// while(!tasten.getButtonCycle(buttonL1)) {
clearCommands();
if(!tasten.getAnyPressed()) {
//lcd.clear();
lcd.println("Warte...");
}
if(tasten.checkButton(buttonB) || tasten.checkButton(buttonUp)) {
pwmA = -215;
pwmB = -255;
//lcd.clear();
lcd.println("geradeaus fahren");
goOn =true;
}
if(tasten.checkButton(buttonC) || tasten.checkButton(buttonDown)) {
pwmA = 100;
pwmB = 255;
//lcd.clear();
lcd.println("rueckwaerts fahren");
goOn =true;
}
if(tasten.checkButton(buttonRight)) {
pwmA = -100; //rechter Motor
pwmB = 100;
//lcd.clear();
lcd.println("rechts lenken");
goOn =true;
}
if(tasten.checkButton(buttonLeft)) {
pwmB = -100;
pwmA = 100;
//lcd.clear();
lcd.println("links lenken");
goOn =true;
}
if(goOn) {
commands[0] = speedA;
commands[1] = highByte(pwmA);
commands[2] = lowByte(pwmA);
commands[3] = speedB;
commands[4] = highByte(pwmB);
commands[5] = lowByte(pwmB);
commands[6] = timeToDrive;
commands[7] = highByte(driveTimeout);
commands[8] = lowByte(driveTimeout);
commands[9] = goDrive;
radio.write(&commands, sizeof(commands));
goOn = false;
}
// }
// tasten.clearAllButtons();
}