Teensy 3.2 + QRE1113 interrupts

Status
Not open for further replies.

amerkay

New member
Hi,

I'm having trouble getting this simple setup working:
Teensy 3.2 with QRE1113. Connected simply 3.3V, GND and PIN 15. I tried connecting it to the 5V out from the L298N I've got, still same issue.

The issue is instead of the expected +1 increment when I put a white paper infront of it, I get an increment of thousands. The same code worked before.

My interrupt test code is here: https://gist.github.com/amerkay/ff5ef3faaeaad84dc63c9b44f275d085, tried different configurations:
Code:
pinMode(encoder_pin, INPUT_PULLUP); 
attachInterrupt(encoder_pin, counter, CHANGE); // also tried FALLING

Any pointers or idea on what do try doing next would be great. I tried the same code using Analog and Digital QRE1113s, same issue.

Thanks!


Output looks like this for putting a sheet of paper infront of the sensor twice:
Code:
[INFO] [1541926697.959634]: pulses: 0, RPM 0, total_pulses: 0
[INFO] [1541926698.960626]: pulses: 4340, RPM 4340, total_pulses: 4340
[INFO] [1541926699.959966]: pulses: 0, RPM 0, total_pulses: 0
[INFO] [1541926700.959823]: pulses: 0, RPM 0, total_pulses: 0
[INFO] [1541926701.959845]: pulses: 1646, RPM 1646, total_pulses: 1646
[INFO] [1541926702.960135]: pulses: 0, RPM 0, total_pulses: 1646
[INFO] [1541926703.959982]: pulses: 0, RPM 0, total_pulses: 1646
[INFO] [1541926704.959873]: pulses: 0, RPM 0, total_pulses: 0
 
Try software debouncing. The Teensy is very fast, and can detect a lot of interrupts where slower boards naturally "low-pass filter" a lot of them out.
 
Status
Not open for further replies.
Back
Top