Posted by Ed Kiser on October 14, 2002 at 21:06:45 from 205.188.209.46 user Kisered.
In Reply to: Re: Morse Code- DOT or DASH? posted by Ed Kiser on October 14, 2002 at 18:47:48:
Stupid me, I had the wrong code for "C".
Hopefully, this version fixes it.
I had it doing DAH DIT DAH DAH, but "C"
should be DAH DIT DAH DIT
Sorry 'bout that...
Hey, I never said I was perfect, but I'm trying...
Ed Kiser, South Florida
--------------------------------------------
'morse.bas
'SEND THE MORSE CODE FOR:
' C Q C Q (hello, anyone, is anybody listening...)
DEFINT I
DEFSTR S
sPITCH = "C" 'pitch of tone generated (in range A-G)
sQUIET = "N0" 'the SILENT note
'try with setting "iT" as being 8 to send slowly
'speed it up with setting "iT" as being 16
'now try it with "iT" being 32, and it buzzes on like a billy-oh...
iT = 8 'sets the timing of rate of transmission
sTRT = STR$(iT) 'define time for dot
iTT = iT \ 2 'define time for dash,
sTRTT = STR$(iTT) ' which is twice time for dot
'get these time delay values into a command string format suitable
' to be passed to the PLAY function:
sONETIME = "L" + RIGHT$(sTRT, LEN(sTRT) - 1)
sTWOTIME = "L" + RIGHT$(sTRTT, LEN(sTRTT) - 1)
FOR I = 1 TO 2 'REPEAT THIS WORD TWICE
: GOSUB DASH 'the character "C"
: GOSUB DOT
: GOSUB DASH
: GOSUB DOT
: GOSUB ENDCHAR
: GOSUB DASH 'the character "Q"
: GOSUB DASH
: GOSUB DOT
: GOSUB DASH
: GOSUB ENDCHAR
: GOSUB ENDWORD
NEXT I
END
'--------------------------------
DOT:
PLAY sONETIME + sPITCH 'generate s SHORT sound
GOSUB SPACE
RETURN
DASH:
PLAY sTWOTIME + sPITCH 'generate a LONG sound
GOSUB SPACE
ENDCHAR:
GOSUB SPACE
GOSUB SPACE
RETURN
ENDWORD:
GOSUB SPACE
GOSUB SPACE
GOSUB SPACE
RETURN
SPACE:
PLAY sONETIME + sQUIET 'the SILENT note
RETURN