rc 3 position switch dc motor sketch

hi
i decided to give in and ask can anyone point me to a sketch that will allow me to run a dc motor using the 3 position switch on a plane style rx (forward-stop-reverse) I'm not really any good at programming and thought tis should be basic
thanks in advance

The most basic question is "how do you have the switch wired"? Without knowing that no code will work or be considered.

Paul

That's not going to be anywhere near "basic" until you describe what you want a lot more precisely.

Plane RXs don't have 3 position switches. Some plane TXs do. So what exactly are you using? A TX and RX or just the switch taken from a TX connected direct to an Arduino? What Arduino? And what sort of "dc motor" do you have? And how is everything powered?

Steve

Hi I'm using rc tx/rx flysky fs i6 and I thought I could use the 3 position switch for a small servo winch I've taken the electrics out and left only the motor and gearing in the servo (so just dc motor)which I've had working through the arduino and a motor shield but I need it to be controlled by the switch as I want the winch for a drone project
And by basic I meant I thought I'd find a sketch that I could use one pin to read 3 values to do 3 different actions (1000=forward 1500=stop 2000=reverse) but I guess it's not that simple lol

Did you try something as basic as searching for "Arduino rc receiver"? There are many examples of code to read the values from an RX channel. Converting those to motor drive is not difficult but exactly how you do it will depend on what controller you use for the motor.

Shame you didn't ask first because it would be even easier if you'd left the electronics in your servo and just converted it into a continuous rotation servo. As it is you will need some sort of motor controller or motor shield (because that's what you took out of the servo).

Steve

Ok so I use another servo and I assume remove that pin to stops it rotating what sketch would I use ?

swoop1:
Ok so I use another servo and I assume remove that pin to stops it rotating what sketch would I use ?

No. If the servo will be connected to a true RC-receiver with standard servo-sockets all you need is a continous-rotation servo.
You can convert a standard-servo to a continous-rotation servo but it requieres more than just removing the mechanical pin. Analog standard-servos have a potentiometer connected to the output-shaft. This potentiometer has to be removed and some electronic modifications have to be done.
From the way you are asking I conclude several things:

  • you are a beginner about electronics
  • you are a beginner about programming
  • your idea about porgramming is "choose the right code and you will be done"
    If you just buy a ready to use continous-rotation-servo and plug it into a free socket of the rc-receiver you are done.
    If you want to do it another way using an arduino you will have to walk up a learning-curve how programming works. This will take at least 2 or 3 weeks of doing basic exercises until you reach a knowledge-level to write your own program that does a task like detect position of a 3-position-switch and control a continous-rotation-servo
    If you think learning porgramming will be fun and if you are willing to
  • write detailed information about your project and detailed information what the program's functionality shall be
  • present your progress in learning which means making clear that you put at least some own effort in your learning all the users in this forum are willing to help with answering to dozens of questions from you.
    best regards Stefan

Of course your right but I'm not trying to go to far into arduino or coding as I'm rubbish at both

I do appreciate your help in pointing me back to a normal servo which I will now mess with for a month or so lol
So thank you guys

What I would call a normal servo is a servo that can turn around 180 degrees = half of a complete rotation.

For robots you can buy RC-servos that do thousands of rotations clockwise and counterclockwise.
millions of rotations if the gear is robust enough to stay alife that long.

here is a video that shows it

best regards Stefan