CLSMB
CLSMB copied to clipboard
did not work with pro mini
hello dear with wireing like in readme file , with arduino pro mini , did not work it seems can not count quadruples encoder.
Hi, Could you test your quadrature encoder with this simple test code?
- Flash Pro mini with test code
- Open tools->Serial Plotter
- Set baud rate to 115200
- Try to rotate quadrature encoder. You should now see A and B signals on plotter.
#define PIN_IN_A 5
#define PIN_IN_B 4
void setup() {
Serial.begin(115200);
pinMode(PIN_IN_A, INPUT_PULLUP);
pinMode(PIN_IN_B, INPUT_PULLUP);
}
void loop() {
Serial.print(digitalRead(PIN_IN_A)*3+5);
Serial.print(" ");
Serial.println(digitalRead(PIN_IN_B)*3);
}
Hi, Could you test your quadrature encoder with this simple test code?
- Flash Pro mini with test code
- Open tools->Serial Plotter
- Set baud rate to 115200
- Try to rotate quadrature encoder. You should now see A and B signals on plotter.
#define PIN_IN_A 5 #define PIN_IN_B 4 void setup() { Serial.begin(115200); pinMode(PIN_IN_A, INPUT_PULLUP); pinMode(PIN_IN_B, INPUT_PULLUP); } void loop() { Serial.print(digitalRead(PIN_IN_A)*3+5); Serial.print(" "); Serial.println(digitalRead(PIN_IN_B)*3); }
yes , this code work, in main code , encoder A and B will be connected to pin 4 and 5 or 2 and 3 in pro mini ?
Sorry, I thought (read) you are using esp2866 chip and ESP2866 branch (I know you wrote arduino pro mini, but but I read it somehow wrongly).
You can try to remove line #define FLIP_ENCODER from config.h file. If it doesn't work you can try to enable debug prints. Set ENABLE_PRINTS to 60 from config.h (it prints values of internal_encoder_position and motor_position). If everything works ok, internal_encoder_position value should increase when motor_position value increases and internal_encoder_position value should decrease when motor_position decreases.
Please be aware about that there are known bug in master branch and you should swap D3 and D8 pins on 8-bit Arduino (this needs also some code changes. I have no time do this :(). StepIn needs RISING interrupt. CHANGE interrupt causes too many interrupts for 8-bit arduino and it starts losing pulses at high speed. This issue has been fixed in ESP2866 branch.