Sending Hexadecimal Numbers with Bluetooth

175 views
Skip to first unread message

pavankumar kavvuri

unread,
Nov 21, 2015, 3:51:46 PM11/21/15
to MIT App Inventor Forum

All my effort since the last 5 hours is to communicate the TV with an android phone. I need to send a decimal or hexadecimal value from the android phone. It can be like 16203967 or F740BF. I got all the appinventor code ready for me in and I am skeptic about the point that whether F740BF a 3 bit number,is received as 3-bit once or 1-bit thrice.
But my receiver needs it to be as straight F740BF. Anyhow it didn't work for me!!.
I expect good suggestions from you.


Thankyou and Thanks in adavance!!!


          PavanKumarK

Abraham Getzler

unread,
Nov 21, 2015, 11:27:01 PM11/21/15
to MIT App Inventor Forum
You need to turn 6 hex digits into 3 bytes of text,
then transmit the 3 bytes of text using the Bluetooth Send Text block.

Add a Web component to your project ion the designer,
to make the necessary conversion block available.

Replicate the attached value procedure BOM, but replace the FEFF with
your 6 letter hex sequence.  The value of the new procedure will be 
your desired 3 byte string, ready to be sent vie the SendText block.

Be sure not to mess up the special punctuation in front and back.

ABG

BOM.png

Abraham Getzler

unread,
Nov 22, 2015, 2:53:10 PM11/22/15
to mitappinv...@googlegroups.com
I generalized the procedure to take a hex string and 
squeeze it down half its size into an encoded (decoded?) text string.

See my hexify() procedure and its sample call, attached.
The second parameter has to be a Web component.
I made it a parameter, because a piece of shareable code shouldn't
assume the existence of global components.

ABG

hexify.bmp
hexify.aia
Reply all
Reply to author
Forward
0 new messages