Replies: 12 comments 19 replies
-
Can you please describe this one in more detail? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Ok it's fixed, I deleted the hub menu file and started from scratch. This time I unselected use template before making the file and everything works. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Hello,
Part of the explanation: I hope this helps. [EDIT] a bit better formatting |
Beta Was this translation helpful? Give feedback.
-
|
Awesome, that works, one more question, Is there a way to write a hub menu so that it automatically advance to the next Mission? so for example I run Mission 1, now it auto advance to mission 2 and I have to only hit the center button once to start it? |
Beta Was this translation helpful? Give feedback.
-
|
Ok I have zero coding experience, that's why I bought the block version. Is this how the menu should look?(I'm sorry I do healthcare and trying to lead kids on this) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Hi @kkhanmd Try this out: import importlib
from pybricks.hubs import PrimeHub
from pybricks.parameters import Button
from pybricks.tools import wait
program_running = True
# list of the mission modules to run
missions = [
"mission1",
"mission2",
"mission3",
"mission4",
"mission5",
"mission6",
"mission7",
"mission8",
"mission9",
"mission10",
]
hub = PrimeHub()
# Press of the center button now does NOT stop the program
hub.system.set_stop_button(None)
# set the control button to the center button
control_button = Button.CENTER
while program_running:
for mission in missions:
print(f"Press the center button to start {mission}.")
hub.display.char("R") # Display "R" for "Ready"
# Wait for the control button to be pressed
while not control_button in hub.buttons.pressed():
wait(10)
print(f"Starting {mission}.")
# Display the mission number (last character of the mission name)
hub.display.char(mission[-1])
importlib.import_module(mission)
print(f"Finished {mission}.")
program_running = False
print("All missions completed.")When the code is run it should do the following:
|
Beta Was this translation helpful? Give feedback.
-
You can hold |
Beta Was this translation helpful? Give feedback.








Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As we code few things we need are
Beta Was this translation helpful? Give feedback.
All reactions