sorry koenntest du das etwas erläutern - OP.find kann ich leider nichts anfangen - wo hast du es gefunden?
sorry koenntest du das etwas erläutern - OP.find kann ich leider nichts anfangen - wo hast du es gefunden?
Sorry - koenntest du das etwas erläutern - mit octagram kann ich leider nichts anfangen - Kontext zur op?
[original post, der erste Beitrag in einem Thread (Internet)]
hi, beim Bewegungsfeld des Kontrollers handelt es sich um ein Achteck https://de.wikipedia.org/wiki/Achteck dem entsprechend kann man es nicht einfach berechnen.
meine versuche
//prozentuale ansteuerung Roemisch I
if (py>=0 && px>0){
if (py-px >= 0) {
linksP = px*w21+py;
rechtsP = 100-px*w2;
//Serial.print("Roemis I O-1");
}
if (py-px < 0) {
if (py > 0){
linksP = py*w21+px;
rechtsP = -100+py*w2;
}
//Serial.print("Roemis I O-2");
}
}
//prozentuale ansteuerung Roemisch II
if (py<0 && px>=0){
if (py+px >= 0) {
linksP = 100+py*w2;
rechtsP = py*w21-px;
//Serial.print("Roemis II O-3");
}
if (py+px < 0) {
linksP = -100+px*w2;
rechtsP = -px*w21+py;
//Serial.print("Roemis II O-4");
}
}
//prozentuale ansteuerung Roemisch III
if (py<=0 && px<0){
if (py-px < 0) {
linksP = +px*w21+py;
rechtsP = -100-px*w2;
//Serial.print("Roemis III O-5");
}
if (py-px >= 0) {
linksP = +py*w21+px;
rechtsP = 100+py*w2;
//Serial.print("Roemis III O-6");
}
}
//prozentuale ansteuerung Roemisch IV
if (py>0 && px<=0){
if (py+px < 0) {
linksP = -100+py*w2;
rechtsP = py*w21-px;
//Serial.print("Roemis IV O-7");
}
if (py+px >= 0) {
linksP = 100+px*w2;
rechtsP = -px*w21+py;
//Serial.print("Roemis IV O-8");
}
}
Der Nintendo Nunchuck auf Anfrage liefert 6 Byte.
Die ersten beiden Byte sind AnalogX und AnalogY, wobei die jeweilige Nullstellung dem Wert 127 entspricht.
Abweichungen entsprechen der Auslenkung des Analogstick.
Mathematisch handelt es sich also um ein um kartesisches Koordinatensystem.
Eine Verschiebung auf den Nullpunkt mit anschließender Skalierung bedeutet mathematisch:
x_proz = (x_analog - 127) *(100 / 127)
Lesezeichen