Which pin is to use?

Sorry for this dumb question :slight_smile:

I want to use this library GitHub - mprograms/SimpleRotary: SimpleRotary is a Arduino library for using basic bare-bones type rotary encoders. Usually these are the cheap ones without the breakout board. - Getting rotary encoder rotation direction. - Getting rotary select button press. - Getting rotary select button long press. - Getting rotary select button press time. - Basic debouncing of rotary / button. - Basic error correcting of out-of-sync rotational readings. - Use of both high and low triggers.

But just dont know which pin it use, i mean is it on Digital pin or Analog pins?

Device - arduino Nano v3

It will tell you in the example sketch you are trying to run.

When a library object is instantiated the pin numbers should be in that line of code.

However, unless an interrupt pin is needed, any pins should work.


If you copy the sketch here we wont have to go get it.

@fyrus, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

The library just uses the pins as digital inputs, so any pin will work, except

  1. pins 0 and 1 because they are the serial connection
  2. pins A6 and A7 because they are analog only
2 Likes

Thanks, so in this default library its use any digital input right? As im using oled and sensor on analog 4,5

Please
Post the sketch you are trying to run here on this thread.

BTW
It's always best to show us a schematic and a good image of the actual wiring.

Please open the link in first post, i was asking about which pin in the library sketch is referring too, analog or digital (A pin / D pin)

From one of the examples

SimpleRotary rotary(6,5,7);

Analog pins usually are most of the time 'numbered' Ax, not x. Also, most examples are written to work on any Arduino; as e.g. an Uno does not have A6 and A7, you can draw your conclusions :wink:

Note: it's safe to experiment; if 5, 6 and 7 don't work, try A5, A6 and A7.

Why? To see how it fails? That's a very strange suggestion.

Hi,
A6 and A7 on a Nano, do not have pullups and from my experience cannot be configured as digital inputs.

Tom... :smiley: :+1: :coffee: :australia:

It should have been the other way around; try the Ax pins first, next the x pins. Sorry.

Add pin 13 of a Nano to that list, because it has an unbuffered LED connected to it.
Leo..

SOLVED

yes its all on digital

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.