Shop OBEX P1 Docs P2 Docs Learn Events
RoamingWithIR — Parallax Forums

RoamingWithIR

i was asked to modify the program RoamingWithIR.bs2 this way:
if either or both IR pair detect and obstacle turn around 180 degrees. pause for one second and continue traveling until another obstacle is detected. after 4 obstacles have been detected the car to stop and signal the detection sequence with the LED lights.

after detecting 4 obstacles the LED lights are to signal the sequence of obstacle detection by flashing for one second followed by a 1/2 second paused as indicated:
for each time the Left IR detected an obstacle the LED will flash once
for each time the Right IR detected an obstacle will flash once
for each time both IR pair detected an obstacle at the same time both LED lights are to flash once

looked every document, posting and video and none helped me so far and i have no clue how to write this code can i get at least a little of help how to make the LED lights have the sequence of blinking ?

thanks!

Comments

  • ercoerco Posts: 20,257
    Sure sounds like a class assignment. We're happy to help but not do it for you.

    Please post the code you have written, and share what it's NOT doing.

    You HAVE read all the course material, right?
  • In your code you should already have irDetectLeft and irDetectRight, so I would have something similar for the LEDs and then use these to keep track of the number of objects each associated IR Detector detected an object. Then check for the number of instances an object was detected and blink the LED accordingly.
Sign In or Register to comment.