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

Encoder reading using Ardunio Mega #66

Open
Mubashir-alam opened this issue Jun 2, 2024 · 0 comments
Open

Encoder reading using Ardunio Mega #66

Mubashir-alam opened this issue Jun 2, 2024 · 0 comments

Comments

@Mubashir-alam
Copy link

I can send PWM signal to the motor and it responds well I am trying to read the encoder value using e but it always shows "0 0"
I modified motor_driver.h according to where my encoder PINs are connected I am using Arduino mega interrupt PINS PIN2,PIN3 AND PIN20,PIN21 for the left and right encoder

/* *************************************************************
   Encoder driver function definitions - by James Nugen
   ************************************************************ */
   
   
#ifdef ARDUINO_ENC_COUNTER
  //below can be changed, but should be PORTD pins; 
  //otherwise additional changes in the code are required
  #define LEFT_ENC_PIN_A 20  
  #define LEFT_ENC_PIN_B 21  
  
  //below can be changed, but should be PORTC pins
  #define RIGHT_ENC_PIN_A 2 
  #define RIGHT_ENC_PIN_B 3  
#endif
   
long readEncoder(int i);
void resetEncoder(int i);
void resetEncoders();

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

1 participant