Skip to content

Encoder reading using Ardunio Mega #66

Description

@Mubashir-alam

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions