Program never progresses #1218
Answered
by
laurensvalk
EclecticInventor
asked this question in
Q&A
-
Using the latest beta, v3.3.0b8 (Pybricks Beta v2.2.0-beta.8), the code never detects white. running the example color detection code shows the sensor is detecting white. Is this a bug or something I'm missing? from pybricks.hubs import InventorHub
from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor, ColorDistanceSensor
from pybricks.parameters import Button, Color, Direction, Port, Side, Stop
from pybricks.tools import wait, StopWatch, run_task, multitask
gameStatus = 0
hub = InventorHub()
hub.display.orientation(up=Side.RIGHT)
coinSensor = ColorSensor(Port.A)
async def coinScan():
while coinSensor.color() != Color.WHITE:
await wait(20)
print ("white")
async def attractMode():
await multitask(coinScan())
#attract mode
run_task(attractMode())
gameStatus = 1 |
Beta Was this translation helpful? Give feedback.
Answered by
laurensvalk
Aug 29, 2023
Replies: 1 comment 4 replies
-
All sensor methods are awaitables, too. Change this: coinSensor.color() to await coinSensor.color() An upcoming documentation update will include Thanks! |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
EclecticInventor
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
All sensor methods are awaitables, too.
Change this:
to
An upcoming documentation update will include
await
on each method where it is needed to make this easier to see.Thanks!