-
Some students and I spent some time this morning trying to diagnose this bug, which I've isolated below:
This results in the following output, in which the second call to
The fix is to put |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
If the documentation says There are some functions that may seem to work without |
Beta Was this translation helpful? Give feedback.
-
Coming in from the cheap seats... I know about multitasking from my computer science classes I took MANY (too many) years ago, but I don't know anything about "await" in python. I'm going to read up on it. But I do know that many of the pybricks commands have an optional "wait=True" or "wait=False" parameter. We used it a lot last year, most commonly to have a medium motor do something while the robot is driving. It seemed to work perfectly. Is there some advantage that we may gain from using await? This sort of feels like a "if it ain't broke, don't fix it" situation. |
Beta Was this translation helpful? Give feedback.
If the documentation says
await
before the function, thenawait
is needed when multitasking.There are some functions that may seem to work without
await
, but what is really happening is that they are running in the background while the program continues with the next lines. So if you did two beeps in a row, it probably wouldn't work as expected withoutawait
.