try something like this.
you ready... Gulp!!
add this to the start with the other variables
Code:
servo1 var word
also add this to the constants. you can edit the min/max number of º it can move here. iv used 20º to be safe.
Code:
servo1_MAX con 20
servo1_MIN con -20
Add this to the Variables too.
Code:
servo1Angle var sword ;Actual Angle of servo1
ok just before [main] add this. this will return the servo to center when you let go of the stick.
Code:
serout SSC_OUT, SSC_BAUD,[servo1\(servo1Angle + 0)\0]
then add this in [main] next to the GOSUB ServoUpdate sub.
Code:
GOSUB CheckAngles
Then add this part to your Controller section. its for X-axis Right stick horizontal movement.
Code:
IF (ABS(DualShock(3)-128) > DeadBand) THEN ;X-axis Right stick horz
servo1Angle = servo1Angle + ((Dualshock(3) - 128)*4)
IF servo1Angle > 1200 THEN
servo1Angle = 1200
ELSEIF servo1Angle < -1200
servo1Angle = -1200
ENDIF
;serout s_out,i14400,[sdec servo1Angle, 13]
serout SSC_OUT, SSC_BAUD,[servo1\(servo1Angle + 0)\0]
ENDIF
Also, add this part to the very bottom of the code.
Code:
CheckAngles:
servo1Angle = (servo1Angle min servo1_MIN) max servo1_MAX
return
Also remember to update your servo driver with servo1,
here i have used pin 13. you can change this to what ever pin you have it connected to. also you can change the name of the servo.
Code:
ServoUpdate:
serout SSC_OUT, SSC_BAUD,["#15P", DEC ldrive, "#14P", DEC ldrive, "#13P", DEC servo1, 13]
return
a nice quick way to change the name of a word though out the whole code is to press
Ctrl+H
type in the word you wish to change and also the new word. then click on "Whole file"
click ok.
then it should scramble thought the code and change that selected word.
good luck.
most of the code i have added here will also be used for the rest of the code when we add it so dont just think this is all just to get one servo working this way.

it might be a good idea to just connect up a single servo thats not built into your robot when testing this... well any code i post really. lol.