Hello everyone, i'm new here! i'm facing a problem programming and controlling one 360 servo using an analog joystick or thumb stick varying speed and just like the one in this video
For a first attempt, just check whether PinReading is over 520 or so - you'll need to experiment to get an appropriate deadband. If it is, increment the stick variable. If it's less than ~500, decrement the stick variable.
Once that works, you'll probably want to make the amount you change stick by to be proportional to how far the joystick is from the centre.
No the Hitec HS-785HB is not a continuous servo nor is it a 360 degree servo. It is a sail winch servo capable of rotating for 6-8 turns (up to 2880 degrees total) but with full positional control. Roughly speaking write(90) will centre it, write(180) will go 3-4 turns in one direction from the centre position and write(0) will go 3-4 turns in the other direction.
Now we have established that, what EXACTLY is it that you want it to do and what is it currently doing that is different.
It looks to me as if the OP wants to control the sail winch servo so that moving the joystick left turns the servo (let's say) clockwise and moving it right does the reverse with a deadband in the middle when the joystick is centred. i.e. exactly what you would want if you were using it on a model sailboat.
wildbill:
It looks to me as if the OP wants to control the sail winch servo so that moving the joystick left turns the servo (let's say) clockwise and moving it right does the reverse with a deadband in the middle when the joystick is centred. i.e. exactly what you would want if you were using it on a model sailboat.
With a model sailboat you would want the servo to stay where it is when you release the joystick. And that is how the code in my link in Reply #7 works.
To demonstrate exactly what i need to do, i just found this video on youtube while looking for something similar and that exactly what i want my servo to do
In that video the person is using a continuous rotation servo.
If you map the output of analogRead() to 0 to 180 and then use servo.write() a continuous rotation servo should behave like the video.
On the other hand, if you are using a sail-winch servo with a limited amount of movement the code in the link I gave you in Reply #7 should be suitable.
That video shows a servo travelling for much more than 8 turns and at varying speeds. You can't do that with a sail winch servo which has only limited travel and also no control at all over the speed it moves at (though you can fudge that using Sweep-style loop techniques or the VarSpeedServo library if necessary).
But basically if that is really what is needed then the OP has the wrong servo.