Shop OBEX P1 Docs P2 Docs Learn Events
Another IR Dectector issue — Parallax Forums

Another IR Dectector issue

StickySticky Posts: 42
edited 2009-10-12 21:10 in Robotics
I'm getting a constant shift between 0 and 1 until I move my hand up close then I get a constant 0, I'm trying this on a 2p, do I have to change the freqout value from 38500 to something to account for the faster chip?

Code (usual stuff, just using different pins)

' {$STAMP BS2p}
' {$PBASIC 2.5}
irDetectLeft VAR Bit
DO
FREQOUT 9, 1, 38500
irDetectLeft = IN10
DEBUG HOME, "irDetectLeft = ", BIN1 irDetectLeft
PAUSE 100
LOOP

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-12 01:45
    Yes, you have to change both the duration value and frequency value in the FREQOUT statement for each type of Stamp module. Look in the Stamp Manual or the Stamp Editor's help files for the specific units needed.
  • C-BobC-Bob Posts: 19
    edited 2009-10-12 21:10
    Yes, Page 199 in Syntax and reference manual http://www.parallax.com/Portals/0/Downloads/docs/prod/stamps/web-BSM-v2.2.pdf
    Your value is 10212
    smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    C-Bob

    Every problem·have at least one·nice, simply and·wrong solution.

    Post Edited (C-Bob) : 10/12/2009 9:15:11 PM GMT
Sign In or Register to comment.