Shop OBEX P1 Docs P2 Docs Learn Events
URGENT HELP! IR SENSOR CODES NOT RUNNING PROPERLY! — Parallax Forums

URGENT HELP! IR SENSOR CODES NOT RUNNING PROPERLY!

Hey guys!
So for the final school project in our computer and science class, we have to build a sumobot. Me and my group mates have successfully built the whole thing, but the IR codes (the ones provided by default or alternatively check the files I've provided) aren't working properly. We have installed the IR sensors and the values for 4.1 just keeps at 1 for both L/R and it won't change. On the other hand, 4.2s code just stays at "On Target" and never changes. HELP PLEASE!!!
Thanks!!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2018-05-25 17:38
    You're using "X = ~Y" to copy an IR input to a variable.

    The "~" operator works with 16-bit signed numbers with 0 as false and -1 (or a non-zero) as true. Your input values are 0 for true and 1 for false. A number of alternatives would work.

    One is "X = Y <> 1"

    Correction: SumoBot-4.1 should show the IR sensor state and it shows 1 always. That suggests a problem with wiring or the sensor. SumoBot-4.2 also shows that the sensors are always 1. Again, something is wrong with the wiring or the sensors. Can you attach a scanned image of the wiring diagram?

    The FREQOUT and the IR sensing don't happen at the same time, but there's a little delay before the IR sensor notices that the IR signal is gone. Don't put anything between the FREQOUT and the reading of the IR sensor. What you have should work.
Sign In or Register to comment.