Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
58
Task/Morse-code/M2000-Interpreter/morse-code.m2000
Normal file
58
Task/Morse-code/M2000-Interpreter/morse-code.m2000
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
Module Morse_code {
|
||||
declare Json JsonObject
|
||||
json$={{
|
||||
"!": "---.", "\"": ".-..-.", "$": "...-..-", "'": ".----.",
|
||||
"(": "-.--.", ")": "-.--.-", "+": ".-.-.", ",": "--..--",
|
||||
"-": "-....-", ".": ".-.-.-", "/": "-..-.",
|
||||
"0": "-----", "1": ".----", "2": "..---", "3": "...--",
|
||||
"4": "....-", "5": ".....", "6": "-....", "7": "--...",
|
||||
"8": "---..", "9": "----.",
|
||||
":": "---...", ";": "-.-.-.", "=": "-...-", "?": "..--..",
|
||||
"@": ".--.-.",
|
||||
"A": ".-", "B": "-...", "C": "-.-.", "D": "-..",
|
||||
"E": ".", "F": "..-.", "G": "--.", "H": "....",
|
||||
"I": "..", "J": ".---", "K": "-.-", "L": ".-..",
|
||||
"M": "--", "N": "-.", "O": "---", "P": ".--.",
|
||||
"Q": "--.-", "R": ".-.", "S": "...", "T": "-",
|
||||
"U": "..-", "V": "...-", "W": ".--", "X": "-..-",
|
||||
"Y": "-.--", "Z": "--..",
|
||||
"[": "-.--.", "]": "-.--.-", "_": "..--.-",
|
||||
}}
|
||||
e = 50 ' Element time in ms. one dit is on for e then off for e
|
||||
f = 1280 ' Tone freq. in hertz
|
||||
chargap = 1*e ' Time between characters of a word
|
||||
wordgap = 7*e ' Time between words
|
||||
|
||||
method json, "parser", json$ as json
|
||||
with json, "itempath" as json.path$()
|
||||
|
||||
|
||||
Input "Send Message:";a$
|
||||
a$=trim$(a$)
|
||||
if len(a$)=0 then exit
|
||||
a$=ucase$(a$)
|
||||
|
||||
for i=1 to len(a$)
|
||||
L$=mid$(a$, i, 1)
|
||||
Print L$;
|
||||
Send(json.path$(L$))
|
||||
next
|
||||
|
||||
sub Send(a$)
|
||||
if len(a$)=0 then wait wordgap : exit sub
|
||||
local i
|
||||
for i=1 to len(a$)
|
||||
select case mid$(a$, i, 1)
|
||||
case "."
|
||||
tone e, f
|
||||
case "-"
|
||||
tone 3*e, f
|
||||
case else
|
||||
tone 3*e, f mod 2
|
||||
end select
|
||||
wait chargap
|
||||
next
|
||||
end sub
|
||||
}
|
||||
Keyboard "This is Morse_code", 13
|
||||
Morse_code
|
||||
27
Task/Morse-code/PascalABC.NET/morse-code.pas
Normal file
27
Task/Morse-code/PascalABC.NET/morse-code.pas
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
const
|
||||
Morse = dict(('A', '.-'), ('B', '-...'), ('C', '-.-.'), ('D', '-..'), ('E', string('.')),
|
||||
('F', '..-.'), ('G', '--.'), ('H', '....'), ('I', '..'), ('J', '.---'),
|
||||
('K', '-.-'), ('L', '.-..'), ('M', '--'), ('N', '-.'), ('O', '---'),
|
||||
('P', '.--.'), ('Q', '--.-'), ('R', '.-.'), ('S', '...'), ('T', string('-')),
|
||||
('U', '..-'), ('V', '...-'), ('W', '.--'), ('X', '-..-'), ('Y', '-.--'),
|
||||
('Z', '--..'), ('0', '-----'), ('1', '.----'), ('2', '..---'), ('3', '...--'),
|
||||
('4', '....-'), ('5', '.....'), ('6', '-....'), ('7', '--...'), ('8', '---..'),
|
||||
('9', '----.'), ('.', '.-.-.-'), (',', '--..--'), ('?', '..--..'), ('\', '.----.'),
|
||||
('!', '-.-.--'), ('/', '-..-.'), ('(', '-.--.'), (')', '-.--.-'), ('&', '.-...'),
|
||||
(':', '---...'), (';', '-.-.-.'), ('=', '-...-'), ('+', '.-.-.'), ('-', '-....-'),
|
||||
('_', '..--.-'), ('''', '.-..-.'), ('$', '...-..-'), ('@', '.--.-.'));
|
||||
|
||||
procedure SayMorse(s: string);
|
||||
begin
|
||||
foreach var c in s do
|
||||
begin
|
||||
foreach var c2 in Morse.get(c.ToUpper, '') do
|
||||
if c2 = '.' then console.Beep(1000, 250)
|
||||
else console.Beep(1000, 750);
|
||||
sleep(1000);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
SayMorse('SOS');
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue