-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with encoder on pins 2 and 3 #47
Comments
BTW, I was able to fix this by disabling servos. I guess somehow the servo code interferes with interrupts on pins 2 and 3. |
Looking at servos.ino, it's clear the problem is that the servos want pins 3 and 4, and attach a servo instance to those pins. That overlaps pins 2/3 being used for the encoder. |
Hi, |
Sitting here two days and thinking my board library does not work! Thanks for the tip! |
@arminf82 did the ros_arduino_bridge work for you? cause it isnt working for me |
Hi,
I'm using ros_arduino_bridge with the Pololu 19:1 CPR motor encoders: https://www.pololu.com/product/2822
The motors and encoders are attached to an Arduino Nano or UNO.
I am consistently seeing the encoder counts on pins 2/3 downscaled by a factor of 40 (for example, while rotating the wheel 1 full revolution, the wheel on A4/A5 reports the right value and the . I read up on the other issues (#29), and noticed that some motor boards use pins 2/3 and so there is a way to make the ISR use another pair of pins. However, I am just using an unshielded Nano or UNO. Either way, I also tried pins 3/5 with the ISR code and the #defines changed as suggested in issue 29- when I do that, I get no readings at all.
To control for variables, I've tried swapping the motors (problem remains on pins 2/3). I've inspected the encoder wave forms, everything looks correct.
Are there other options, such as using PORTB, or mechanisms to debug why the (apparently correct) encoder pin changes aren't leading ot the right encoder counts?
The text was updated successfully, but these errors were encountered: