Open
Description
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?
Metadata
Metadata
Assignees
Labels
No labels