rotary encoder

i've got a bourns pec11 rotary encoder, but i dont know where everything should go.
I looked at the datasheet, however it's all cryptic to me.

i see three prongs on one side and two on the other. The three prongs need to be connected to the outputs on the arduino?

Then the two connections are for the on/off button?

Thanks

Hi,

you need only the three pins on one side. The middle one (C) to ground and the outer ones to input A and B. Enable the pull ups on the input pins. Then it should work. To enable the pull up resistor write the follwing code

pinMode(pina,INPUT);
digitalWrite(pina,HIGH); // enable pullup
pinMode(pinb,INPUT);
digitalWrite(pinb,HIGH); // enable pull up

Good luck
Mike

pullup is referring to the push button?

and i place a and b in the analog in area?

No, both channels A & B terminals and one of the push button switch terminals will wire to digital input pins that have their internal pull-up resistors enabled. The common on the encoder and other of the push button terminals will wire to ground.

the internal pullups... arduino has built pullups?

im just going by this sketch, but it's not working for me.
http://www.arduino.cc/playground/Main/RotaryEncoders

the internal pullups... arduino has built pullups?

The AVR internal pull-up resistor option is covered in this article:

http://www.arduino.cc/en/Tutorial/DigitalPins

Lefty

for the button, is it only briefly "HIGH" or is it put "HIGH" when clicked then will only be "LOW" when you click it in again?

for the button, is it only briefly "HIGH" or is it put "HIGH" when clicked then will only be "LOW" when you click it in again?

When not pressed the button will read as a constant HIGH (due to the pull-up enabled), until you press it and it will then read a constant LOW until you release it.

Lefty

Hi,

with the intrnal pull ps enabled, do not use the wring mentioned in your link, instead wire the common pin to ground. If you would go with the wiring you mentioned, the you need on pin A and pinB and the push button an additional resistor to ground (1kOhm approx.)

Mike