Skip to first unread message

MrsB

unread,
Jun 5, 2018, 3:15:42 PM6/5/18
to MIT App Inventor Forum
Hello,

   I'm having a problem with the control flow when the "Run Maze" button is clicked.  I want the robot to do each step sequentially, move the 1st distance, turn, move the 2nd distance turn, etc.  But it seems it is trying to do all the steps at once.  If I remove the multiple steps and have it just move the 1st distance, it works correctly.  If I ask it to just do the first turn, that works.  

   The goal of the app is to have my 2nd grade students measure the distances and record the turns of a very simple maze, then have the robot run the maze to check their measurements.

  Any help or suggestions would be greatly appreciated!

Mrs. B
LegoMaze.aia

Chris Ward

unread,
Jun 5, 2018, 3:44:33 PM6/5/18
to MIT App Inventor Forum
Hello MrsB

While waiting for a response from an expert familiar with the Lego components, What I can see is that you have a number of missing blocks in your If-then-else statements. That can cause issues down the line.

Instead of this:


Use this:




MrsB

unread,
Jun 5, 2018, 5:03:38 PM6/5/18
to MIT App Inventor Forum
I'm not seeing that error in my version, perhaps I uploaded a old version.   Sorry!  I see that section as this:


LegoMaze1.aia

Ghica

unread,
Jun 6, 2018, 10:54:56 AM6/6/18
to MIT App Inventor Forum
Hi,
I have seen this thing once, about 2 years ago, very briefly. So I know as Chris.
I think your problem arises because you are indeed trying to start all actions at the same time. There must be a way to find out whether an action of the robot has been completed. 
If you moved the robot by tacho count, you could use the tacho count changed event, if you move the robot for some duration, you could use a clock, otherwise I have no idea.
Cheers, Ghica.

Ghica

unread,
Jun 6, 2018, 11:11:10 AM6/6/18
to MIT App Inventor Forum
Actually, I am wondering if it is possible at all to do what you want. There are plenty of examples of using the Lego robot, but I found none that could run a maze by itself. They all rely on interactive commands.
Maybe you can do something like: let the student press a next button when he/she sees that the robot completed his action, or, have a clock timer that is long enough to cover all actions, and each time the clock.Timer fires, start the next action.

MrsB

unread,
Jun 6, 2018, 1:19:46 PM6/6/18
to MIT App Inventor Forum
Thanks for the help.  I ended up changing the app so the students hit a button after each measurement and direction.  I couldn't figure out a way to have the tacho count trigger the next step.  And the timer would add too much waiting time for the students.  

Thanks again!

Mrs.B
Reply all
Reply to author
Forward
0 new messages