Skip to first unread message

Brian Degen

unread,
Jan 5, 2015, 8:23:24 AM1/5/15
to mitappinv...@googlegroups.com
trying to code a morse code app for a high school project, but cant figure out how to get a string of text to be translated. I got individual letters to work, but anymore than one letter wont work. is there a way to split the text into individual characters and go from there? keep in mind i am new to app inventor.

CONFIDENTIALITY NOTICE:  This message is from the West Morris Regional High School District.  This message and any attachments may be confidential and/or privileged and are intended only for the individual(s) or group(s) identified as the addressee.  If the message addressee is in error, or you are not authorized to read, copy, or distribute this message or attachments; please delete this message and attachments and notify the sender by return email at the address listed above. 

SteveJG

unread,
Jan 5, 2015, 8:46:22 AM1/5/15
to mitappinv...@googlegroups.com
Hi Brian.   What are you attempting to do?

Convert a string of text     like a b c d     to dots and dashes   . -   _ . . .   -.-.     or play the sounds of morse code.
What you want to do probably can be done several ways.

1) Using  the text  length block.   Check the entire length of the text.  That tells you how many characters in the screen, then use the length to identify the first character 1, the second character 2  and so on.    If you want dots and dashes,   write out the code in a list, with each character of the alphabet   A, B, C, D ....   then write a second list  with  . -, -...,-.-.,-..    for example, then when you cycle through the length of the screen   use the look up in pairs blocks to associate the two lists, the actual characters and the dot dash character representation.   When list item 1 is  Q  have the App print --.-     and so on.   You could print these to a string by using the Text blocks and a join    or directly to a label.     Remember, you will have to handle spaces between words.

2) Create 26 sound files with the Morse character tones plus punctuation?    Instead of having list 1 point to a dot dash sequence, have it point to a sound file and use the sound file to play it?


The AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page, will help you to learn to use the blocks.

Try some stuff.   If you have issues, return and post a screen capture of your blocks and describe the problem.  Someone will provide advice.

73 and have fun

de WB5KIA
 



Reply all
Reply to author
Forward
0 new messages