I’ll get the problem out of the way quickly in case it rings any bells: after letting a motor run for 500 ms my wheel encoder returns 0 with no error.
I’m not sure what I did wrong here. I may have had the wires crossed at one point and mixed GND & VCC or VCC & OUT A/B or something like that. I don’t think I did, but anything’s possible at this point.
I’ve certainly got everything hooked up correctly right now. The little black boxes on the encoder PCB sit directly below the teeth in the 42x19mm wheel. I’ve never turned the trimpots or anything like that. I don’t have an oscilloscope handy, but I can probably get access to one.
The code I’m using:
#include <pololu/orangutan.h>
int main()
{
svp_set_mode(SVP_MODE_ENCODERS);
set_digital_output(IO_B4, LOW); // Make SSbar an output (C only)
int counts[2], errs[2];
while(1)
{
svp_get_counts_and_reset_ab();
set_motors(100, 100);
delay_ms(500);
set_motors(0, 0);
clear();
counts[0] = svp_get_counts_and_reset_ab();
counts[1] = svp_get_counts_and_reset_cd();
errs[0] = svp_check_error_ab();
errs[1] = svp_check_error_cd();
lcd_goto_xy(0, 0);
print_long(counts[0]);
print(" ");
print_long(counts[1]);
lcd_goto_xy(0, 1);
print_long(errs[0]);
print(" ");
print_long(errs[1]);
delay_ms(1000);
}
}
So if my code’s not wrong, maybe I need to order another set of encoders?