How do you Convert Binary to Text in MIT App Inventor?

Hi everyone,

I found a way to convert text to binary in MIT App Inventor, but I’m struggling to do the reverse: converting binary back to text.

Here’s the code I’m using to convert text to binary:

xd.aia (8.9 KB)

Now, I need to decode a binary sequence back into readable text. Is there a way to achieve this in MIT App Inventor using built-in blocks or an extension? Any help or guidance would be greatly appreciated!

Thanks in advance!

ref here..

incomplete blocks you have provided in the aia

Some more javascript ideas here (includes solutions for text to binary as well):

My fault, I've uploaded an old version of the program, this should be working
emitter.aia (9.3 KB)

Thanks for the linke, I've tried with it also but doesn't work for me. It converts chart by chart, i need all the text converted at the same time, just the way it converts text2bin in the program i've sent

Thx for the info, i've been reading it and i find it a little complicated to implement in a MIT coding

Some examples here:

Also see

https://groups.google.com/d/msg/mitappinventortest/M99AtISaHM0/bSYj7O3qAwAJ

for a blocks only approach.

can't open groups. google, could you show me in another way?thks

THKS, maybe using a list and a loop with bin2Ascii method could help

Here's the code from that post, with draggable blocks too.



AsciiCHRASCprocedures.aia (4.4 KB)


(Some of the png files could not upload to this board. You can find them in the aia.)

Hello there again, thx for all the information provided. I need something more related to what I provided. The steps I should follow would be.

  1. I have a string in binary. Eg: 10010101
  2. Converting this string into ASCII code
  3. Converting this ASCII into text form

Challenges:
• all this binary msgs have it's header (you can apply wtever you want)
• every ASCII code must get 8bits/frame

Eg complete program:
11111111 11001100 11100011 11011100 110101010
Header: 11111111
11001100 -> 68(ASCII) -> H
11100011 -> 45(ASCII) -> O
11011100 -> 77(ASCII) -> L
110101010 -> 86(ASCII) -> A

Show msg: hola

How did you come up with this?

image

image

You could use an ascii table for conversion...

asciiTable.csv (1.6 KB)
(convert this to an AI2 list in your app)

It's an example, I've made up the numbers to illustrate how I was trying to do it

Btw, someone knows an AI useful in block-coding? ChatGPT is not working well ok that

How do you know how long the header is?
Is it always just 8 bits?

The non-extended ASCII table only covers 7 bits.

To dump a file you would need to learn Javascript, as in

Like so ?

image

binaryToText.aia (3.1 KB)

(the binchar.csv contains only upper and lower case alphabet and number 0-9)

Note it may be better to use for each number from to avoid issues with repeat binary values.

Just like that yes :). Although I need it to decode every text. But that's the idea!!!

:question:

If you need other characters, add them to the binchar.csv file. The list from csv table block did not like some of the characters.