Teensy High Low threshold

Status
Not open for further replies.

Mr.teensy

New member
Hello,
I recently got a teensy 3.6 and I wanted to try it out with ir sensors (tsop31240). According to its datasheet the signal pin is high when there is no signal. When I connect it and do digitalRead() it says 0, but then I do analogRead() and it is around 950. As far as I understand that should be digitalRead() = 1? How can I correct it, can I move the HIGH -LOW threshold?

TSOP31240 datasheet -> https://www.vishay.com/docs/82492/tsop312.pdf
 
Are you setting pinmode to INPUT before doing the read? Teensy pins are disabled on reset not input like an AVR.

Page two of the data sheet shows that the output stage is a low side transistor with a pullup, so if it's not getting quite high enough for the digital logic sitting pinmode INPUT_PULLUP may get there. That said 950 is well withing the 0.7 of 1024 which most digital circuits consider logic high.
 
Status
Not open for further replies.
Back
Top