Hi,

I'm trying to program my robot to do some simple task. Basically all the robot needs to do is run a set of ten instructions (consisting of: move forward for 2 seconds, move backward, turn right, turn left) in a loop for all eternity. However whilst doing this it needs a sensor listener to determine when one touch sensor is activated. When this happens another separate set of ten instructions should be run. After these new instructions have been completed we return to executing the first set of ten instructions.

So basically the robot will roam around using a random set of ten instructions forever, until it hits something, then it runs a different set of instructions once, then returns back to the first block of instructions.

I have currently tried using behaviors, but i cannot get the 'main' behavior to loop. If we take the simple bumper car example (in the lejos tutorial) I effectively want to loop the DriveForward routine indefinitely, but in such a way that we are continually looping through instructions, so it may go forward, turn left, froward, turn right and it just keeps looping. And of course in a way where it still responds to the touch sensor being activated.

Can anybody offer some ideas on how to solve this problem (hopefully I've explained myself well :-) ) ? Any help will be truly appreciated.

Many Thanks
Gary Stoneman


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Lejos-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lejos-discussion

Reply via email to