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.

73 lines
1.6 KiB

4 years ago
4 years ago
4 years ago
  1. #include <PCD8544_SPI.h>
  2. #include <shiftRegButtonLib.h>
  3. #include <myInterrupts.h>
  4. #define CLR_BIT(p,n) ((p) &= ~((1) << (n)))
  5. #define SET_BIT(p,n) ((p) |= (1 << (n)))
  6. #define BL 10 //backlight, Hintergrundbeleuchtung LCD
  7. #define SD_CARD_CS 2 //D2 ist Chip Enable
  8. #define BAT_VOLTAGE A7 //Akkuspannung an A7
  9. #define _OE_LEVEL 7 //D7 fuer Output Enable Pegelwandler
  10. #define BRIGHTNESS OCR1B
  11. //globale Objekte anlegen
  12. volatile PCD8544_SPI_FB lcd;
  13. volatile myInterrupts Timer2;
  14. volatile myInterrupts pwmBL;
  15. volatile shiftRegButton tasten;
  16. //LCD
  17. uint8_t renderTime = 0;
  18. #define renderTimeout 100
  19. //Kommandos
  20. #define nothing 9 //reset/nichts tun
  21. #define speedA 1 // set speed A + speed
  22. #define dirA 2 // set direction A + dir
  23. #define speedB 3 // set speed B + speed
  24. #define dirB 4 // set direction B + dir
  25. #define goDrive 5 //go + time to go
  26. #define stopDrive 6 //stop
  27. #define getTemp 7 //get temperature
  28. #define timeToDrive 8 //Zeitdauer des fahrens
  29. #define getDistance 10 //Abstand zu Objekten
  30. int pwmA = 0;
  31. int pwmB = 0;
  32. bool forwardA = true;
  33. bool forwardB = true;
  34. bool driveOn = false;
  35. uint16_t driveTimeout = 0;
  36. int distance;
  37. int temperature;
  38. //Funk
  39. #include <SPI.h>
  40. #include <nRF24L01.h>
  41. #include <RF24.h>
  42. RF24 radio(A2, A3); // CE, CSN
  43. const byte address[6] = "00001";
  44. uint8_t commands[32];
  45. /*
  46. const String mainMenu[] = {
  47. "fahren", //0
  48. "stoppen", //1
  49. "manuell fahren", //2
  50. "", //3
  51. "", //4
  52. "", //5
  53. "", //6
  54. "", //7
  55. "", //8
  56. "" //9
  57. };
  58. const String subMenuEntry0[] = {
  59. "Zeitdauer",
  60. "Speed A",
  61. "Speed B",
  62. "Starten"
  63. }; */