Hi All,
I have a hall encoder gearmotor connected to an ESP32.
Motor is: https://uk.banggood.com/CHIHAI-MOTOR-GM25-370-DC-Gear-Motor-6V-100210300RPM-Encoder-Motor-p-1016183.html?ID=519629&cur_warehouse=CN
Using a simple test program:
const byte interruptPin = 5;
const byte otherPin = 4;
int valC1 = 0;
int valC2 = 0;
void setup() {
Serial.begin(115200);
Serial.println("Start");
pinMode(interruptPin, INPUT);
pinMode(otherPin, INPUT);
}
void loop() {
valC1 = digitalRead(interruptPin);
valC2 = digitalRead(otherPin);
Serial.print(valC1);
Serial.print(",");
Serial.println(valC2);
delay(100);
}
Turning the shaft slowly I get this sequence:
11
01
11
10
Etc
It should be:
11
01
00
10
Etc
I’ve tried pull up and pull down resistors.
Anyone seen this before? Is it a faulty encoder or am I missing something?
Thanks in advance.
Sam