Shop OBEX P1 Docs P2 Docs Learn Events
PENGUIN ROBOT Text Messaging - the Code — Parallax Forums

PENGUIN ROBOT Text Messaging - the Code

HumanoidoHumanoido Posts: 5,770
edited 2007-11-08 09:44 in Robotics
Title: Penguin Morse Code Text Messaging and Language Translator
Code Name: penguin_morse_messaging
Purpose: Create messages that Penguin remembers, converts to Morse
Code, and then speaks the language


With this detailed code, Penguin robot speaks a new language ,
remembers and sends text messages, and can help with learning code and
earning a Ham Radio license.

You type in your text message into some simple data statements and let
Penguin do the rest! Penguin bot will remember the text, and automatically
language translate it from English characters into Morse. Then Penguin will
actually speak the language!

With this code example, Penguin will say:

cq cq cq
hello
my name is penguin.
1 2 3
testing


humanoido
humanoido said...
This code is dedicated to a good friend who is studying for his
Amateur Radio license. He explains, "Ever since they lifted the requirements for
Morse code at the entry level, it enabled a lot of people to get into the field.
However, once in and seeing the benefits of going farther, many want to learn
Morse at 5 wpm, upgrade the license, and go all the way down to the 160
meter band."
' This program handles the entire alphabet, all numbers and special
' characters, and outputs a Morse Code message using Penguins'
' peizo speaker and Debug screen. The text message is composed and
' placed into data statements at the end of this program. The
' message is entered in lower case.

' When the program is run, the message will be stored into Penguins'
' EEPROM memory, read out character by character, translated into
' Morse, then output as text on the debug screen, converted to
' sound and played in the form of dits and dahs (. and -).

' The message will remain in memory, and will play once. To repeat
' the message any number of times, add in the FOR NEXT loop to the
' Main program. This way, an SOS could continuously be sent.
' The program includes the full table of Morse as seen below
' (with the exception of the double quote sign ").
'
' The program stores a number of large text strings into EEPROM with
' the DATA directive and then sends them, one character at a time via
' the Debug command and Converter. This saves program space by storing
' large amounts of data in EEPROM directly, rather than embedding the
' data into DEBUG commands.

' Data is retrieved one byte at a time and "sent" with a single debug
' (or SEROUT) and audio output.
'
' Paragraphs can be added by changing the statements in the Main
' program. For example, to change the number of paragraphs from
' the current capacity of two, to say four, use the following code:
'
' FOR Phrase = 1 to 4
' LOOKUP (phrase - 1),
' [noparse][[/noparse]Text1, Text2, Text3, Text4], idx

'    A  .-          N  -.          1  .----       .  .-.-.-
'    B  -...        O  ---         2  ..---       ,  --..--
'    C  -.-.        P  .--.        3  ...--       ?  ..--..
'    D  -..         Q  --.-        4  ....-       (  -.--.
'    E  .           R  .-.         5  .....       )  -.--.-
'    F  ..-.        S  ...         6  -....       -  -....-
'    G  --.         T  -           7  --...       "  .-..-.
'    H  ....        U  ..-         8  ---..       _  ..--.-
'    I  ..          V  ...-        9  ----.       '  .----.
'    J  .---        W  .--         0  -----       :  ---...
'    K  -.-         X  -..-        /  -..-.       ;  -.-.-.
'    L  .-..        Y  -.--        +  .-.-.       $  ...-..-
'    M  --          Z  --..        =  -...-

' The Morse code is based on sending patterns of short and long sounds.
' The long sound is always three times as long as the short sound.
' The short sound is called "dit" and the long sound is called "dah".
' The numerals are all made up of five dits and dahs. The letters of the
' alphabet have from one to four sounds, and the most common letters have
' the shortest patterns (for example, e = dit, t = dah, s = dit dit dit,
' q = dah dah dit dah). Punctuation marks have six sounds, e.g. period = dit
' dit dah dah dit dit. Within one letter or numeral, the time between sounds
' is supposed to be the same length as the dit. The time between different
' digits in a sequence like "50" is supposed to be the same length as a dah.

Post Edited (humanoido) : 11/9/2007 2:45:20 AM GMT
Sign In or Register to comment.