how to set the range in rotary encoder

hi
i need help..
how to set the range in rotary encoder using Arduino..
i need complete code

What do you mean by "set the range"?

It will be a big help if you describe the project you want to create and the role of the encoder within the project.

If you just want someone to write a program for you please ask in the Gigs and Collaborations section of the Forum and be prepared to pay.

If you want to learn to program yourself the examples that come with the Arduino IDE are a good place to start. They probably cover all the techniques you will need. There are also many online tutorials. Also see the Useful Links Thread.

...R

Google "arduino rotary encoder" for lots of examples, with complete code.

how to set the range in rotary encoder using Arduino

You don’t, a rotary encoder will accumulate pulses forever. The number of pulses you get for 360 degrees of rotation is fixed by the type of encoder you get.

i explain my project…

i made one vehicle my own self … its have two wheel and have two brake and break link is connect into e- actuator and the actuator working is simple dc motor…
when the motor is rotate cw mean actuator is pulling and CCW mean push i connect the motor into driver
to control the motor by using Arduino

and i fix the encode into the string wheel…

my condition…

when i rotate CW mean the LH brake leaver is pull the
when i rotate CCW mean the RH brake leaver is push the
when i stop the string wheel the actuator also stop…
and i off the Arduino mena its will another position of home…

Rajapalani:
and i fix the encode into the string wheel..

my condition..

when i rotate CW mean the LH brake leaver is pull the
when i rotate CCW mean the RH brake leaver is push the
when i stop the string wheel the actuator also stop..
and i off the Arduino mena its will another position of home..

And what are you having a problem with?

...R

i connect the Arduino in vehicle battery 12 v

if i stop the steering CCW half mean the value show in -some valve ex(-100)..

and i off the vehicle and again switch on mean Arduino take CCW position in 0 like ex(-100 position it will s take 0 )

I find it very hard to understand your description of your problem.

Is the problem caused by the fact that the encoder does not know its position when the Arduino starts? Maybe you need to move the steering wheel to the centre position and then press a button to let the Arduino know that it is to treat that position as the centre?

Or a simpler solution might be to ensure the steering wheel is at the centre position before you switch on the Arduino.

...R

Rajapalani:
i connect the Arduino in vehicle battery 12 v

That's a worry! :astonished:

Since the Arduino runs on 5 V, I do hope you have an adequately rated switchmode "buck" converter to derive the 5 V to operate the Arduino, fed to its "5V" pin and ground as well as all other 5 V devices. Otherwise I foresee problems. :cold_sweat: