main menu #1401
Replies: 3 comments 2 replies
-
Hi! Here are some suggestions to make more advanced menus and shared functions for more flexibility: |
Beta Was this translation helpful? Give feedback.
-
This is the approach I used with my FLL team for Submerged
Each SM_t#_rev##.py file has a T#_Run() which replaces the traditional main() function. at the end of each .py file we have a run_task(T#_Run()) command commented out. we uncomment the run_task() when we want to run the task manually on the robot. |
Beta Was this translation helpful? Give feedback.
-
Here is our way to implement it. We use the hub.system.storage function to store the previous executed route to the storage which is retained between routes (and even you power off the hub). The byte stored in the storage is simply a number (e.g. 1-11). And at the beginning of your menu file, read the number in the storage. Based on the number you read (representing the last executed route), you set different menus. e.g.
Then in each selection, besides running your code, add the previous route by 1 and refresh the hub.system.storage with the new number. In this way, after you finish your run 1 and press the start button again, the menu will automatically be set to "2". You don't need to use the left/right button to change selection. Meanwhile, you still keep the possibility to switch back to previous routes using the right button if you want to re-run it. |
Beta Was this translation helpful? Give feedback.
-
hi and you hope you are doing well, I am participating in the FLL, I use a robot inventor hub and I have 11 runs and code and waste time changing between code btw I use a main menu but it take time so there is any method to when a code finished passe automatically to the next code after clicking on a button.
This the my main code:
for exmple when i finish the run 7 it take a lot of time to run code 8
Beta Was this translation helpful? Give feedback.
All reactions