In this guide I will show you how to set up a program in UIFLow which uses multiple pages when run on the Core2 AWS.
The code I created looks like this:
While the code may look big and confusing the four big blocks are actually just duplicates with only the Page name and Button cables changing between each page.
I did encounter a memory recursive issue with this cade which resulted in me having to use the "Execute Code" block in UIFlow to import gc and then trigger a gc.collect in each code block.
The Page code.I started by creating a template function for each page that looks like this:
The template is a function that holds the information for each page and when a button is pressed, the next function is called.
gc.collect() is used to clear the memory at the start of each page to prevent memory stack overflow which causes the ESP32 to crash and reset.
In order to trigger the code I needed to set the start of the function like this:
All this code does is load the screen1 function and import the gc commands to trigger the gc.collect() functions.
The example only has four pages because there are only three buttons and each page changes the pages that are accessible from that page.
This is only a basic example and I'm sure it can be used and extended in numerous ways.
If you have any questions, feel free to ask.
Thanks again for visiting!
Comments
Please log in or sign up to comment.