in a fit of ill-thought-out late night shopping I ordered some motors from ebay... these ones to be exact:
canon ironcore motor with encoder
there's a datasheet available for the motor, but not for the encoder.. the motor has two wires coming out of the top end of the housing in addition to the two wires at the bottom. I'm able to drive the motor without a problem, but my (perhaps overly simple) attempt to use an encoder library to count pulses did not work...
I used this library: GitHub - PaulStoffregen/Encoder: Quadrature Encoder Library for Arduino
I used the sample code and plugged the two wires into pins 20 and 21 (interrupt) on my mega. for good measure, I connected the power and ground for the motor to the motor shield as well. the program should send the current position to the serial monitor, but when i rotate the shaft, perhaps unsurprisingly.. no change.
usually a few google searches can get me going in the right direction, but i'm at a loss here... any help would be appreciated. not sure what's the best way to share code here, so I attached the example file I used. I just changed the pins from default to 20, 21.
Basic.pde (741 Bytes)