\ Morse Code on the LaunchPad. \ Connections: P1.4 --->------8 Ohm Speaker-----<---P1.5 decimal variable freq 500 freq ! variable duration 100 duration ! 16 P1 2CONSTANT p14 ( one pin is P1.4 ) 32 P1 2CONSTANT p15 ( the other pin is P1.5 ) 48 P1 2CONSTANT LS ( Loud Speaker between both pins) : ini ( -- ) p14 cset p15 cclr green cclr ; ( crosswise!) : wait ( -- ) freq @ 0 DO LOOP ; ( wait a little bit) : switch ( -- ) LS ctoggle ; : tone ( d -- ) ini red cset 0 DO switch wait LOOP ; : pause ( d -- ) ini red cclr 0 DO wait LOOP ; : short duration @ ; : long duration @ 3 * ; : dit short tone short pause ; : dah long tone short pause ; : .. long pause ; ( inter-element gap between the dots and dashes within a character) \ Morse Alphabet : A dit dah .. ; : B dah dit dit dit .. ; : C dah dit dah dit .. ; : D dah dit dit .. ; : E dit .. ; : F dit dit dah dit .. ; : G dah dah dit .. ; : H dit dit dit dit .. ; : I dit dit ; : J dit dah dah dah .. ; : K dah dit dah .. ; : L dit dah dit dit .. ; : M dah dah .. ; : N dah dit .. ; : O dah dah dah .. ; : P dit dah dah dit .. ; : Q dah dah dit dah .. ; : R dit dah dit .. ; : S dit dit dit .. ; : T dah .. ; : U dit dit dah .. ; : V dit dit dit dah .. ; : W dit dah dah .. ; : X dah dit dit dah .. ; : Y dah dit dah dah .. ; : Z dah dah dit dit .. ; : _0 dah dah dah dah dah .. ; : _1 dit dah dah dah dah .. ; : _2 dit dit dah dah dah .. ; : _3 dit dit dit dah dah .. ; : _4 dit dit dit dit dah .. ; : _5 dit dit dit dit dit .. ; : _6 dah dit dit dit dit .. ; : _7 dah dah dit dit dit .. ; : _8 dah dah dah dit dit .. ; : _9 dah dah dah dah dit .. ; : // 7 0 DO short pause LOOP ; ( Pause between words) \ Commonly used two letter procedural signals : AA A A ; ( End Of Line) : AAA A A A ; ( Full Stop) : AR A R ; ( End of message) : AS A S ; ( Stand by; wait) : BK B K ; ( Break ) : BT B T ; ( Separation - break - between address and text; between text and signature) : CL C L ; ( Going off the air: clear) : CQ C .. Q ; ( Calling any amateur radio station) : DE D E ; ( This or From) : GB G B ; ( Good bye, God Bless) : GD G D ; ( Good, Good Day) : GE G E ; ( Good Evening ) : HH H H ; ( Error in sending. 8 dits - Transmission continues with last word correctly sent.) : II I I ; ( Short form of above ) : IMI I M I ; ( Repeat; I say again. Difficult or unusual words or groups.) : KA K A ; ( Beginning of message) : KN K N ; ( Go only, invite a specific station to transmit) : NR N R ; ( Number follows ) : OK O K ; ( Correct) : SGD S G D ; ( Signed) : SK S K ; ( Out; clear - end of communications, no reply expected.) : SOS dit dit dit dah dah dah dit dit dit .. ; ( Mayday! Without character pauses!) : VE V E ; ( Understood) : >> F O R T H // I S T // S U P E R ; : TITANIC begin SOS // again ; : KR K i n d // r e g a r d s // t o // t h e // S V F I G // M e e t i n g // SGD M K D B ; ( finis)