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.

108 lines
2.9 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. void manualDigitalDrive() {
  2. bool goOn = false;
  3. String temp_str = "T: " + String(temperature) + " Grad C";
  4. lcdLines[5] = temp_str;
  5. // while(!tasten.getButtonCycle(buttonL1)) {
  6. clearCommands();
  7. if(!tasten.getAnyPressed()) {
  8. <<<<<<< HEAD
  9. //lcd.clear();
  10. lcd.println("Warte...");
  11. =======
  12. lcdLines[0] = "Warte...";
  13. >>>>>>> 48327ec5c42c4d70afa8e9c00bbf52ab2db2ca05
  14. }
  15. if(tasten.checkButton(buttonB) || tasten.checkButton(buttonUp)) {
  16. pwmA = -215;
  17. pwmB = -255;
  18. <<<<<<< HEAD
  19. //lcd.clear();
  20. lcd.println("geradeaus fahren");
  21. =======
  22. lcdLines[0] = "geradeaus fahren";
  23. >>>>>>> 48327ec5c42c4d70afa8e9c00bbf52ab2db2ca05
  24. goOn =true;
  25. }
  26. if(tasten.checkButton(buttonC) || tasten.checkButton(buttonDown)) {
  27. pwmA = 100;
  28. pwmB = 255;
  29. <<<<<<< HEAD
  30. //lcd.clear();
  31. lcd.println("rueckwaerts fahren");
  32. =======
  33. lcdLines[0] = "rueckwaerts fahren";
  34. >>>>>>> 48327ec5c42c4d70afa8e9c00bbf52ab2db2ca05
  35. goOn =true;
  36. }
  37. if(tasten.checkButton(buttonRight)) {
  38. pwmA = -100; //rechter Motor
  39. pwmB = 100;
  40. <<<<<<< HEAD
  41. //lcd.clear();
  42. lcd.println("rechts lenken");
  43. =======
  44. lcdLines[0] = "rechts lenken";
  45. >>>>>>> 48327ec5c42c4d70afa8e9c00bbf52ab2db2ca05
  46. goOn =true;
  47. }
  48. if(tasten.checkButton(buttonLeft)) {
  49. pwmB = -100;
  50. pwmA = 100;
  51. <<<<<<< HEAD
  52. //lcd.clear();
  53. lcd.println("links lenken");
  54. =======
  55. lcdLines[0] = "links lenken";
  56. >>>>>>> 48327ec5c42c4d70afa8e9c00bbf52ab2db2ca05
  57. goOn =true;
  58. }
  59. if(goOn) {
  60. commands[0] = speedA;
  61. commands[1] = highByte(pwmA);
  62. commands[2] = lowByte(pwmA);
  63. commands[3] = speedB;
  64. commands[4] = highByte(pwmB);
  65. commands[5] = lowByte(pwmB);
  66. commands[6] = timeToDrive;
  67. commands[7] = highByte(driveTimeout);
  68. commands[8] = lowByte(driveTimeout);
  69. commands[9] = goDrive;
  70. radio.write(&commands, sizeof(commands));
  71. goOn = false;
  72. }
  73. //Temperatur <3
  74. unsigned long currentMillis = millis();
  75. if((unsigned long)(currentMillis - temp_time) >= 1000){ // jede Sekunden
  76. temp_time = millis();
  77. bool err = false;
  78. clearCommands();
  79. commands[0] = getTemp;
  80. radio.write(&commands, sizeof(commands) && !err);
  81. unsigned long start = micros();
  82. radio.startListening();
  83. while(!radio.available()){
  84. //Serial.println("nix");
  85. unsigned long currentMicros = micros();
  86. if((unsigned long)(currentMicros - start) >= 1){
  87. err = true;
  88. }
  89. }
  90. if(!err){
  91. int16_t readData;
  92. radio.read(&readData, sizeof(int16_t));
  93. temperature = readData;
  94. }
  95. radio.stopListening();
  96. clearCommands();
  97. }
  98. // }
  99. // tasten.clearAllButtons();
  100. }