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

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. void manualDigitalDrive() {
  2. bool goOn = false;
  3. // while(!tasten.getButtonCycle(buttonL1)) {
  4. clearCommands();
  5. if(!tasten.getAnyPressed()) {
  6. //lcd.clear();
  7. lcd.println("Warte...");
  8. }
  9. if(tasten.checkButton(buttonB) || tasten.checkButton(buttonUp)) {
  10. pwmA = -215;
  11. pwmB = -255;
  12. //lcd.clear();
  13. lcd.println("geradeaus fahren");
  14. goOn =true;
  15. }
  16. if(tasten.checkButton(buttonC) || tasten.checkButton(buttonDown)) {
  17. pwmA = 100;
  18. pwmB = 255;
  19. //lcd.clear();
  20. lcd.println("rueckwaerts fahren");
  21. goOn =true;
  22. }
  23. if(tasten.checkButton(buttonRight)) {
  24. pwmA = -100; //rechter Motor
  25. pwmB = 100;
  26. //lcd.clear();
  27. lcd.println("rechts lenken");
  28. goOn =true;
  29. }
  30. if(tasten.checkButton(buttonLeft)) {
  31. pwmB = -100;
  32. pwmA = 100;
  33. //lcd.clear();
  34. lcd.println("links lenken");
  35. goOn =true;
  36. }
  37. if(goOn) {
  38. commands[0] = speedA;
  39. commands[1] = highByte(pwmA);
  40. commands[2] = lowByte(pwmA);
  41. commands[3] = speedB;
  42. commands[4] = highByte(pwmB);
  43. commands[5] = lowByte(pwmB);
  44. commands[6] = timeToDrive;
  45. commands[7] = highByte(driveTimeout);
  46. commands[8] = lowByte(driveTimeout);
  47. commands[9] = goDrive;
  48. radio.write(&commands, sizeof(commands));
  49. goOn = false;
  50. }
  51. // }
  52. // tasten.clearAllButtons();
  53. }