Below is some justbasic code I used to make an application for using a joystick to pan/tilt a two servo cam setup in ~2005. The servo controller was not an arduino, but the code basics should be useable with an arduino
open "joystick demo" for graphics as #joy
OPEN "com3:9600,N,8,1,CD0,CS0,DS0,OP0" FOR OUTPUT AS #2
#joy "down" 'put the pen down
#joy "trapclose [quit]"
timer 10, [readStick] 'every ten ms read the stick
wait
[readStick]
scan
readjoystick 1 'either 1 or 2
#joy "place 50 50"
#joy "\Reading X = "; Joy1x
#joy "\Reading Y = "; Joy1y
#joy "\Reading Z = "; Joy1z 'throttle slide
#joy "\Reading X = "; (Joy1x - 1200)/195
#joy "\Reading Y = "; (Joy1y - 1200)/195
x = (Joy1x - 1200)/195
y = (Joy1y - 1200)/195
x1 = int(x)
y1 = int(y)
#joy "\Reading X1 = "; x1;" "
#joy "\Reading Y1 = "; y1;" "
#joy "\Reading jb1 = "; Joy1button1;" "
#joy "\Reading jb2 = "; Joy1button2;" "
if Joy1button1 = 1 then
PRINT #2, CHR$(00); CHR$(128); CHR$(x1);
PRINT #2, CHR$(01); CHR$(128); CHR$(y1);
end if
if Joy1button2 = 2 then
PRINT #2, CHR$(00); CHR$(128); CHR$(x1);
PRINT #2, CHR$(01); CHR$(128); CHR$(y1);
end if
wait
[quit]
CLOSE #2
close #joy
end