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

#define xPin A5
#define yPin A6
int16_t xValue = 0;
int16_t yValue = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
koordinaten(analogRead(xPin), analogRead(yPin));
Serial.println("X: ");
Serial.println(xValue);
Serial.println("Y: ");
Serial.println(yValue);
delay(200);
}
void koordinaten(uint16_t x, uint16_t y) {
//9-bit reichen, der ADC schafft bestenfalls 8-bit praezision
x = x >> 1;
y = y >> 1;
xValue = map(x, 0, 511, -255, 255);
yValue = map(y, 0, 511, 255, -255);
}