Shop OBEX P1 Docs P2 Docs Learn Events
IR Remote Applications — Parallax Forums

IR Remote Applications

Bot LearnerBot Learner Posts: 9
edited 2007-05-16 03:51 in Learn with BlocklyProp
Hi all!

I just finished the IR Remote for the Boe-Bot kit and it was a lot of fun!smile.gif

I did have a problem, though.

While doing Chapter 3 Project 1 I·tried to modify·the 7BitRemoteBoeBot.bs2 code to include input from the IR LEDs for collision avoidance, but couldn't get it to work. The input at IN0 was always a zero so there was no movement with the remote control 2 or ChUp command. After making multiple changes with no success,·I tried the code suggestions in the Solutions section. These changes didn't work either as the input at IN0 was still always zero.··Then I moved the commands to check the IR detectors to just after the DO command and before the GOSUB Get_Ir_Remote_Code instruction in the main routine and it worked great. (Code attached)

I'm thinking the problem is ·in the timing of checking the IR detectors while the code keeps jumping to the Get_Ir_Remote_Code· subroutine before the IR detectors are polled. Anyone have any insights into the problem?

TIA

Bot Learner

Comments

  • edited 2007-05-16 00:30
    Bot Learner,

    Cool; glad you liked it.

    I think your code needs to make sure to check for an object during the IR remote's pause between messages.· Since the PBASIC program only grabs the first 7 bits, the code has to wait until the existing message ends.· So, add PAUSE 4 after the Get_Ir_Remote_Code subroutine call.· Then, check the IR detectors after that, and there should be no interference.

    Andy

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.
  • Bot LearnerBot Learner Posts: 9
    edited 2007-05-16 00:58
    Hi Andy!

    I moved the code checking for the IR distances to just before the Select statement as noted in the solutions section. I then added the PAUSE 4 after the GOSUB command as you suggested and it works as advertised.

    Might this be a candidate for the Errata document?

    Thanks for the help!

    Bot Learner
  • edited 2007-05-16 03:51
    Definately a candiade for an erratum. Thanks Bot Learner!

    Andy

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.
Sign In or Register to comment.