The blocks area did not load properly. Changes to the blocks for screen 5601220778393600_Screen1 will not be saved

Hi,
I've loaded your app without any error (on server ai2.appinventor.mit.edu.).
I cannot test by running it since I haven't an Arduino simulating the BT communication with your app, anyway I've found a "ghost, empty black" block that was giving an error and I removed it.
In addition to that, please check the following image: the third if-then should address "LOCKER 3" , not "LOCKER 2", isn'it ?
image

Then, here : "...for OUR protection" or "...for YOUR protection" ?

image

The Rx clock should be rewritten as follows (this requires that the last sending from Arduino be made with a BTserial.println(); i.e. it shall be closed with the Linefeed string terminator.
image

The screen initialize shall initialize the clocks, only after having loaded the Time intervals. The options "always run" and "enabled" shall be unticked at design level. "Always fires" means that the clock can fire also in background, and this typically creates problems: it's better to disable this feature.
image

Here below the .aia modified. accordingly.
Smart_Locker_v1US.aia (1.3 MB)

Lastly: depending on the security level that you want to achieve, it could be higher if you send the password to the Arduino as well, and on the Arduino to check whether the sent password is the wanted one, instead of just sending 1,2,3. But this is an improvement that you can implement later, when everything will already be working.
Best wishes.

Hi sir

I revised my MIT apps from one screen to two screens, and it worked as expected, but now my concern is how I can send data to a specific location in MIT apps.

Here's the expected location :
image

i upload my arduino complete code here :
https://codeshare.io/lonMJj

i'm not sure if this is possible.
Smart_Locker_v1.2.aia (1.3 MB)

and thank you for the advice; I will add information as you stated above.

Hello dear @Unknown_Source,
honestly to work with multiple screen is typically not preferable, due to the data passing between screens that is "tricky" and due to the fact that clocks running on one screen continue to run also when another screen is on focus, therefore creating unexpected behaviours. In addition to this, a Bluetooth enabled on one screen, cease to work when another screen is activated, and must be reinitialized every time you switch between screens.
I suggest you to return to your previous approach and to verify ii the .aia that I sent you back still has problems or if they have been solved. In a nutshell: "one screen is better than two" . You can always use the "virtual screens" approach. If you search on the forum you will find tutorials on this matter (i.e. how to use virtual screens).
Last, but not least, i'm leaving for a couple of days, therefore I will have time to see in detail your questions, only on my return. If you want to have faster responses, please publish these posts on the community (by sending e-mails to me, nobody else can read them), so someone else will answer you while I'm not available.
Cheers and have a nice weekend. :+1:

1 Like

Keep safe and cheer ups

1 Like

Hi sir good day can i disturb you again

Hello dear @Unknown_Source ,
nice to read you again. I haven't forgot you and you don't disturb me at all :slight_smile:
I just had a quick look to yur last post yesterday evening, but the time that I can dedicate to AI2 is quite little ..(job, family, etc......).
Anyway, you can let me have your Arduino file (you can annex it directly to the post because in my experience of cybersecurity, I prefer not to access to shared platforms) I will have a look on it. The chunck of code that you have posted is not so clear to me : i.e. "val" is a command coming from the app and "value" is the value that you want to send to the App, and dataCommunication is the serial line used for the BT ?
Let me suggest again to make this message exchange "public" to the forum: you'll have better chances that someone else could have useful hints to help you solving the problem faster than referring only to myself.
All the best !!!

...ooooppppsss I've read this last post after I wrote mine :upside_down_face:.
I'm awfully sorry, but In this particular matter (firebase) I have honestly any experience: the AI2 Staff appointed me as a power user in relation to Arduino interface and coding, but for other aspects you'd better refer to the whole forum. :cold_sweat:

1 Like

Oh, I hope somebody will help me out on it. :disappointed:

Dear @Unknown_Source,
I've revised your Arduino code. Please pay attention to the comments therein.
Smart_Locker.ino (2.8 KB)
I haven't run it,but at least it compiles error free.

I wholeheartedly recommend you to make a first step with a very basic code on both Arduino and AI2 to verify that the BT comms works between the two.
There are Hardware and Software requirements that must be complied with, to have the communication working. Only after having had success in this, you can be more confident that the rest will work also.
In these cases normally I suggest to browse the web sites of Juan Antonio (kio4.com) and of Chris Ward (professorcad.uk) where you can find a lot of AI2 and Arduino code that will lead you to successfully achieve the communication.
Best wishes.

1 Like

Thank you, sir; I got more information in every reply you made. Thank you for enlightening me. It was very clear, and I got a great idea from you. I will keep it all in mind, and I thank you for the links. I will visit them.

1 Like

Dear @Unknown_Source,
I really hope that what I'm capable to do, could help you. Fel free to write me should you need any deepening.
Cheers and good luck !

1 Like

Hi Sir
Good afternoon
How can I compare the two values? something like if currentVersion is equal to newUpdate, then open a new screen; else, get the linkNewupdate value, then update currentVersion to be equal to newUpdate.

image

Hi,
whether the data you are looking for are of text type (since you've shown them all enclosed between quotes ""), then you can do like here below:

Sir, how about if the data is from Firebase? I want to provide the two data sets from the database not in the label text so that it can be checked directly in the database.

Hi,
my code was just an example whose aim is to show you the mechanism. :slightly_smiling_face:
The rationale is: if the data you are working on are strings (text type) you can retrieve the data from the firebase, assign them to text variables, compare them, than you can take whatever decision according to the comparison results (for example to restore them in the database with the new values).

I tried but i didn't get lucky tonight. Thanks sir :blush:

After many try i got it but still have error hehehe

Nice to read you make it working but (still) what error ? :thinking:: :hushed:

When my screen is load it will automatic Login, isn't successful Login but still log in hehehe