Hi all!
I have a couple of questions about how global variables work.
- Are global variables declared on one screen only known to that screen, or can they be accessed from another screen's blocks?
- Are global variables declared on one screen re-initialized each time the screen displayed?
Here are my blocks:
What I am trying to do is, each time the app is started, try to connect to one specific BlueTooth device - 'ESP32test'. I am using a flag, 'Global BT_attempt' to test if the app has tried to connect to the device.
I have a second screen (Screen2) for app settings, and when I go to that screen and return to the main screen (Screen1), the app again attempts to connect to the device. So it appears, 'Global BT_attempt' is initialized each time the screen is displayed.
Is there anyway to have the 'Global BT_attempt' retain it's value when switching screens?
In c programming, I'd declare this to be a 'static boolean' variable. Does ai2 have anything similar to this?
Thanks for any help!
Randy