Skip to content
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

Problem with encoder readings on A4 A5 #55

Open
chrissunny94 opened this issue Mar 30, 2018 · 2 comments
Open

Problem with encoder readings on A4 A5 #55

chrissunny94 opened this issue Mar 30, 2018 · 2 comments

Comments

@chrissunny94
Copy link

chrissunny94 commented Mar 30, 2018

I have tried setup the connections properly , while testing i am always getting flawed reading (almost static ) on the Analog ports . I am using an Arduino UNO , the encoders are connected directly to the arduino .

For the motor control , i am using L298.

What should i do to change , to change the A4,A5 pin to any of the portD pins .

`
/* Interrupt routine for LEFT encoder, taking care of actual counting */
ISR (PCINT2_vect){
static uint8_t enc_last=0;

enc_last <<=2; //shift previous state two places
enc_last |= (PIND & (3 << 2)) >> 2; //read the current state into lowest 2 bits

left_enc_pos += ENC_STATES[(enc_last & 0x0f)];

}

/* Interrupt routine for RIGHT encoder, taking care of actual counting */
ISR (PCINT1_vect){
static uint8_t enc_last=0;

enc_last <<=2; //shift previous state two places
enc_last |= (PINC & (3 << 4)) >> 4; //read the current state into lowest 2 bits

right_enc_pos += ENC_STATES[(enc_last & 0x0f)];

}`

What should i change here?

@chrissunny94
Copy link
Author

Sorry , wires were lose , sorted .

@Femi-Tofade
Copy link

Hi, did the ros_arduino_bridge give you correct odometry readings? My encoders are connected directly to the wheelchair too...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants