I am writing a Python program for a robot that will play the "simon carabiner". The task is accomplished by a series of functions...and the goal is to have every function execute in its entirety before moving on to the next. The problem I'm having, however, is that the program moves on to the second function before executing all the lines in the first function. In other words, it skips the function half way through. The solution I came up with involves using booleans. The function returns a "True" which is saved in a dummy variable; the second function will only execute if the value of the dummy variable is true. Furthermore, since the first function may or may not execute in its entirety in the first iteration, the whole program is on an endless "while(1)" loop. That way, the program will run as many times as it takes to execute every line in the function. I know this is not the best possible solution, but that's why I am here. If you guys have any input on the matter, I'd really appreciate that. Just to give you an idea of what the program looks like, here's scaled-down version of the actual code. The actual code is too long. Not sure if this info is needed, but I'm using a beaglebone black microcontroller using cloud9 IDE. http://ift.tt/1D54XcS
Aucun commentaire:
Enregistrer un commentaire