Actually, you could use the and block here since it is lazily evaluated left to right. The problem is that the checks need to be ordered such that the is a number? check comes first so if it fails the rest of the code won't run (which the above code doesn't do).
Hi !
I still have this issue with an application using the serial OTG component with Arduino.
What is the result of your investigation into the Physicaloid library ?
I've been looking for a while for an update...Is there any available ?
Regards
Are you using the Serial component or the SerialOTG extension? I cannot speak for the extension, but there is an update for the Serial component in process to address the Android 12+ issues. You can try out the test server at http://nb190a-bugfixes.ai2-ewpatton-temp.appspot.com/.
Thanks for answering !
Yes i'm using the serialOTG extension.
FYI the code is working with the AI companion 2.64. But i have the run
time error with version 2.65
And it never works with the .apk build (on the test server also).
IHM_208.aia (231.6 KB)
An idea when the update addressing the Android 12+ issues will be released ?
Regards
Unfortunately I can't assist with the OTG extension since it's not published by MIT. @rkl099 may want to have a look though.
As discussed in Using serial with FTDI - #117 by rkuba
the SerialOTG version in GitHub - rkl099/Appinventor_Debug: Debug versions: SerialOTG, Modbus and test programs (Note: can be changed any time). has been updated so it should work with Android12 and has been tested by some users, as I don't have access to an Android12 device.
Your error code is probably from your block code and not from the extension.
It seems that you do a Read in your timer function without testing if you have received something. Read is a nowait function and returns an empty string or all character that have been received since last call. See Appinventor-SerialOTG/SerialOTG_1.4.pdf about Read and discussion about message handling.
The extension works on Android12 on the normal server. Test server is not necessary.
I believe it is ai feature (it has always been that way) that when you request substring fully or partially outside the input string parameter instead of returning existing part (or empty) it raises uncatchable error. It is so different than any language I know that I consider it bug or at least impovement candidate. Rationale:
- It can be cheaply imemented in library once (dry)
- It requires lot of ugly and old-fashioned if-thens on every use instance in every app from every developer made further complicated by modest string function set (anti-dry)
- It is not logical as 2-element subset of empty set is a perfectly valid empty set and most (all?) other languages to it that way
Eg substring ("key",2,5) = "ey", substring("key",5,5)="", substring("",1,5)="".
@ewpatton pls include such improvement in nearest ai2 release.
Thank you, it is working now on my Samsung A51
(Android 12)
hello,
I have read this chat to solve the problem about the App inventor Serial component and the FLAG IMMUTABLE /MUTABLE. My app has to talk with arduino by serial too.
I built my app in december 2022 and the apk worked fine with android 11 but failed with android 12 and 13.
Reading this chat I can understand how to solve the problem can you help me?
Thanks in advance
Mirko
sorry I cannot understand how to solve.....
See the answer here
Taifun