Shop OBEX P1 Docs P2 Docs Learn Events
Infrared sensor — Parallax Forums

Infrared sensor

Robot FreakRobot Freak Posts: 168
edited 2006-12-14 17:17 in General Discussion
I've found a infrared example on the Yahoo group, but it also sends infrared with an transmitter.
I don't need that, because i'm using an infraredball, but I can't find the correct things to delete...
Isn't there a simple way like CPU.readport() or something?

Thanks!

Post Edited (Robot Freak) : 12/11/2006 7:57:14 PM GMT

Comments

  • Robot FreakRobot Freak Posts: 168
    edited 2006-12-13 19:48
    Nothing?
    I'm using the IR receiver from parallax:
    www.parallax.com/detail.asp?product_id=350-00014

    Post Edited (Robot Freak) : 12/13/2006 8:46:27 PM GMT
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-12-14 12:49
    According to the docs at your link, the IR detector outputs
    a low signal when it detects a 40kHz infrared signal.
    So you can use CPU.readPin() to test wether you get
    a low or high signal.
    To decode a pulsetrain requires more info.
    What program did you find at the yahoo group?
    Please attach it to your post.

    regards peter
  • Robot FreakRobot Freak Posts: 168
    edited 2006-12-14 16:08
    In the zip folder JBot i've got the following examples:
    IrRangeSensorTest1
    IrRangeTest1

    And packages:
    IrRangeDropOffSensor
    IrRangeSensor
    IrRangeSensorTask

    But they all work with a transmitter (I think)
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-12-14 17:17
    Yes, those programs change a DAC output to change
    the intensity of a led and so are able to measure distance.
    With an independant light source you cannot measure distance
    but you can detect light.
    The only statement from those programs that applies to detecting light
    is
    ····· if(!CPU.readPin(detectorPin)) {
    ······· //light detected
    ····· }
    ····· else {
    ······· //light not detected
    ····· }

    You might want to try using
    · int time = CPU.pulseIn(32767,detectorPin,false);
    which measures a low going pulse in 8.68usec units

    regards peter
    ·
Sign In or Register to comment.