Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Teensy High Low threshold

  1. #1
    Junior Member
    Join Date
    Aug 2017
    Posts
    3

    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

  2. #2
    Senior Member
    Join Date
    Apr 2013
    Posts
    1,936
    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.

  3. #3
    Junior Member
    Join Date
    Aug 2017
    Posts
    3
    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
  •