Increment servo with joystick?
i'm trying make pan/tilt system, im having 0 luck. have hooked right(i think), trying make when move joystick right, servo rotates right. when let go, want servo stop in place, not bounce back. also, right whether move joystick left or right, servo moves left. whut.
code: [select]
valx = analogread(joyx);
if(valx>520) valx++;
if(valx<450) valx--;
if(valy>520) valy++;
if(valy<480) valy--;
bases.write(valx);
delay(50);
your code snippet poorly written. try this:
code: [select]
valx = analogread(joyx);
bases.write(map(valx,0,1023,0,180));
Arduino Forum > Using Arduino > Programming Questions > Increment servo with joystick?
arduino
Comments
Post a Comment