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.

28 lines
513 B

  1. #define xPin A5
  2. #define yPin A6
  3. int16_t xValue = 0;
  4. int16_t yValue = 0;
  5. void setup() {
  6. Serial.begin(9600);
  7. }
  8. void loop() {
  9. koordinaten(analogRead(xPin), analogRead(yPin));
  10. Serial.println("X: ");
  11. Serial.println(xValue);
  12. Serial.println("Y: ");
  13. Serial.println(yValue);
  14. delay(200);
  15. }
  16. void koordinaten(uint16_t x, uint16_t y) {
  17. //9-bit reichen, der ADC schafft bestenfalls 8-bit praezision
  18. x = x >> 1;
  19. y = y >> 1;
  20. xValue = map(x, 0, 511, -255, 255);
  21. yValue = map(y, 0, 511, 255, -255);
  22. }