Skip to first unread message

Kent Young

unread,
Nov 28, 2017, 2:28:36 AM11/28/17
to MIT App Inventor Forum

Hi all, first off just want to say I LOVE App inventor!!! Fantastic job!!
Now the nitty gritty...
Been trying to find a solution for this for two weeks, uncle...!
What I'm trying to accomplish:
1) Copy a text file (which contains lines that are terminated with CRLF) from a USB drive to a tablet.
2)Select file and send the file to a Bluetooth-to-Serial adapter which will be read by an embedded controller.
3)I cannot modify the embedded controller.
4)I know that AI2 strips the CR on file read, and I am trying to re-insert it for Bluetooth send.
Attached are the blocks I have tried.
As you can see on the Putty capture (serial in to my PC for testing) as each line comes in there is a NL but no CR.
I have followed a thread by Pura Vida on the Google forums about the fact that the CR's are stripped.
Basically any help would be great, or if you can just tell me it can't be done...
Thanks,
Kent
SendFile.png
PuttyCap.png

Chris Ward

unread,
Nov 28, 2017, 6:21:47 AM11/28/17
to mitappinv...@googlegroups.com
I haven't tried this but maybe you could use the Unicode characters for CRLF, that is of course if the controller is Unicode compatible.

Must say I am very surprised that AI2 strips out the CRs by default - that should at most be an option really?


EDIT

Actually, it's unlikely that a control device will be Unicode Compatible. Are you sure the device needs CRLF? It might just be that you can use new line only (\n).

What you see in Putty is Putty's interpretation of the file. The same file in Windows for example, could display differently in different software.

Abraham Getzler

unread,
Nov 28, 2017, 10:24:18 AM11/28/17
to MIT App Inventor Forum
See this CRLF Gallery project for how to do it using
a trick of Web encoding.


CRLF.aia
CRLF_to_LF.png
hexify.png
length_of_CRLF.png
LF.png
TAB.png
CR.png

Chris Ward

unread,
Nov 28, 2017, 10:49:26 AM11/28/17
to MIT App Inventor Forum
Hi Abraham

That is an extremely useful example :)

Abraham Getzler

unread,
Nov 28, 2017, 11:09:28 AM11/28/17
to MIT App Inventor Forum
Thanks for the reminder - it was time for me to add it to the Text section

ABG

Kent Young

unread,
Nov 28, 2017, 12:17:05 PM11/28/17
to MIT App Inventor Forum
Thanks for both of the quick responses!!
Chris, I have verified that the controller needs a CRLF at the end of the line. (This thing is circa 1980's)
Abraham your solution worked perfectly!!
I would been another month searching before I even came close to that solution!! THANK YOU!!!!
See the attached... formats it correctly now!!


NewPuttyCap.png
LFtoCRLF.png
Reply all
Reply to author
Forward
0 new messages