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.
#include <PololuWheelEncoders.h>
void setup() {
PololuWheelEncoders::init(2,4,8,7);
}
int one = 0;
int two = 1;
void loop() {
Serial.println(PololuWheelEncoders::getCountsM1());
Serial.println(PololuWheelEncoders::getCountsM2());
delay(1000);
}
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() {
PololuWheelEncoders::init(9,12,9,12);
}
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.