Hi there,
Would it be possible for someone to help a newbie out please?
I’m building an obstacle avoiding robot and I’ve connected two pololu wheel encoders ( one for each micro metal gearmotor + the pololu wheels) up to my arduino uno using the code below:
#include <PololuWheelEncoders.h>
PololuWheelEncoders encoders;
void setup() {
encoders.init(2,12,3,13);
Serial.begin(19200);
delay(1000);
Serial.print("Start");
Serial.println();
}
void loop()
{
Serial.print(encoders.getCountsM1());
Serial.print(" ");
Serial.print(encoders.getCountsM2());
Serial.print(" ");
Serial.println();
}
I’m getting 0’s and 1’s or -1’s as an output in my serial monitor when I manually turn the motors and I’m not sure how to use this information to calculate distance. Should I be getting an incremental output? How can I tell how many times the wheels have rotated?
I know this stuff may be pretty basic but I’ve done quite a thorough search and have just ended up more confused.
Any help will be appreciated!