Only one ecnoder using Arduino Nano

[b]We are using only one encoder with an Arduino Nano in our design.

The following example code gives us an error if we initialize only 2 lines.[/b]
#include <PololuWheelEncoders.h>

void setup() {

int one = 0;
int two = 1;

void loop() {


The error is :
ADC_PWM.ino: In function ‘void setup()’:
ADC_PWM:53: error: no matching function for call to 'PololuWheelEncoders::init(int, int)

The function is looking for 4 I/O’s to be initialized.

To get over this problem we initialized the same lines twice.
#include <PololuWheelEncoders.h>

void setup() {

Will this work?

Is there any other way around this?

We are out of GPIO’s and cannot blank initialize any I/O’s.
Please let us know if there is a solution around this or if there is a version of a modified library somewhere.


I have moved your post into its own thread.

Which Pololu encoder are you using? You might try passing a pin number that does not exist, such as 255, to the extra two pins. If this does not work, you might consider trying an Arduino encoder library like this “Encoder Library” that supports using a single encoder.