Multiple Tasks in a Do...Loop
surfline27
Posts: 8
Hi there,
I'm using the Boe-Bot kit with Basic Stamp Editor to complete a "mission" which is to make the Boe-Bot navigate through an obstacle course (which is a white floor surrounded by black spray paint as a border) and stop when it detects a bright light near it using the phototransistor (like a desk lamp pointing downwards). I have used whiskers, IR sensors and a phototransistor.
My problem is that I have all the stuff I need each part to do its task but I'm having trouble putting it all together in one Do...Loop statement
For example to go through the course I would make it:
1. Check ambient light (before the Do...Loop statement)
2. Check IR sensors (for sensing black)
3. Check whiskers (for objects in the way)
4. And then start moving through the course
I tried this:
(Check Ambient light)
Do
IF...Then... (for IR sensors with a bunch of ElseIf statements in it for the left and right sensors)
ElseIf...Then...(whiskers with a bunch of ElseIf statements in it for the left and right whiskers)
ElseIf...Then...(checking for the desk lamp)
EndIf
(code for moving forward)
Loop
But it doesn't do all the tasks....it will detect the black with the IR sensors and avoid it but if one of the whiskers is hit, it won't do anything about it (it will keep moving forward).
How do I put it all together in the Do...Loop statement so it can perform whatever task is needed?
Any help would be appreciated
I'm using the Boe-Bot kit with Basic Stamp Editor to complete a "mission" which is to make the Boe-Bot navigate through an obstacle course (which is a white floor surrounded by black spray paint as a border) and stop when it detects a bright light near it using the phototransistor (like a desk lamp pointing downwards). I have used whiskers, IR sensors and a phototransistor.
My problem is that I have all the stuff I need each part to do its task but I'm having trouble putting it all together in one Do...Loop statement
For example to go through the course I would make it:
1. Check ambient light (before the Do...Loop statement)
2. Check IR sensors (for sensing black)
3. Check whiskers (for objects in the way)
4. And then start moving through the course
I tried this:
(Check Ambient light)
Do
IF...Then... (for IR sensors with a bunch of ElseIf statements in it for the left and right sensors)
ElseIf...Then...(whiskers with a bunch of ElseIf statements in it for the left and right whiskers)
ElseIf...Then...(checking for the desk lamp)
EndIf
(code for moving forward)
Loop
But it doesn't do all the tasks....it will detect the black with the IR sensors and avoid it but if one of the whiskers is hit, it won't do anything about it (it will keep moving forward).
How do I put it all together in the Do...Loop statement so it can perform whatever task is needed?
Any help would be appreciated
Comments
The part that I haven't finished yet is to check for the desk lamp light at the end
This is how it looks so far after changing some stuff:
Thanks for all your help guys.
How do I turn it off?