Hey freunde =) ist schon etwas her seid meinem letzten projekt bin also wieder ein wenig eingerostet ^^
also es geht hier um folgendes;
ich versuche mit einem, Analogstick aus einem Xbox Controller 2 servos zu steuern … den einen ( rechts links ) den anderen / oben unten)
das problem ist nur das der eine servo überhaupt keinen mux macht und der der andere mehr zittert und “krampft” als alles andere
hier mal mein aufbau
vill. fällt euch schon hier ein fehler auf
hier mein skript …billig zusammengepfuscht aus dem Beispiel und einem Hingespinsgt … geht mit sicherheit besser !
/*
Controlling a servo position using a potentiometer (variable resistor)
by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
modified on 8 Nov 2013
by Scott Fitzgerald
http://arduino.cc/en/Tutorial/Knob
*/
#include <Servo.h>
Servo myservo; // create servo object to control a servo
Servo myservo2;
int potpin = 0;
int potpin2 = 5; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
int val2;
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
myservo.attach(10);
}
void loop()
{
val = analogRead(potpin);
val = analogRead(potpin2); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
val2 = map(val2, 0, 1023, 0, 180);
myservo.write(val); // sets the servo position according to the scaled value
myservo2.write(val2);
//delay(15); // waits for the servo to get there
}
(sry wegen der rechtschreibfehler xD habe eine neue tastaur ^^