Forum Rule: Always post complete source code & details to reproduce any issue!
-
Teensy High Low threshold
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.
-
Sorry for the late reply, but yes I didn't configure them as INPUT, and it solved it. thank youu
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules