. .- ... -.-- --..-- / .. / .-- --- ..- .-.. -.. / -- .- -.- . / .. - --..-- / -... ..- - / .. / -.. --- -. .----. - / .... .- ...- . / - .. -- .
I know its stepping a bit back in time (just a bit), but I just thought it would be cool to send messages from player to player with morse code. Normally I would make the code myself, but this time I'm stepping aside to let my idea/challege spread to the community. Imagine PM'ing someone with morse code. It sounds cool, and you dont even have to understand what it says, as you would be able to simply convert it back into text.
EDIT: This should be done in Expression2![]()
. .- ... -.-- --..-- / .. / .-- --- ..- .-.. -.. / -- .- -.- . / .. - --..-- / -... ..- - / .. / -.. --- -. .----. - / .... .- ...- . / - .. -- .
"If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
-- Niels Bohr
Wire FPGA
I recently made a string converter for transmitting data in signals after converting to binary, complete with sound accompaniment...this seems almost simple by comparison![]()
The Olympus Technologies drones, totally not SkyNet in Gmod form.
Cronus: The Ultimate Drone, definitely SkyNet in Gmod form.
The gBrain Project, the drone controls system that thinks it's better than you
Need to learn how to make your own drones? Check out Drones with a Mad Scientist for my tutorials on how to do it.
I made these a year ago:
Morse out:
Use keyboard to enter a string. When pressing Enter it sends.
Uses a wirelinked colorer to color a PHX plate Red and White. ( Lol )
Morse in:
Uses a ranger aimed at the plate to get the red color.
It first get's the whole string until it receives the end signal.
Then converts the morse code into a string.
When the signal is interrupted it will show that with an _ .
Code is old and unoptimized, but it works.
e2 Code:
@name Morse Out @inputs Color:wirelink Start KB:wirelink Reset @outputs Char Send String:string StringClk MorseString:string Keyboard @persist Morse:string LastKeyboard # 13 32 97 122 if (!Send) { interval(10) Keyboard=KB:readCell(1) if (Keyboard & Keyboard!=LastKeyboard & !Send) { if ((Keyboard>=97 & Keyboard<=122)|Keyboard==32) { String=String+toChar(Keyboard) } if (Keyboard==127 & String) { String=String:left(String:length()-1) } if (Keyboard==13) { Enter=1 } StringClk=1 LastKeyboard=Keyboard } } if (!Keyboard) { StringClk=0 } if (Send==2) { interval(100) if (Char<MorseString:length() & clk()) { Char++ Color:setNumber("Fire",0) if (MorseString:index(Char)=="=") { Color:setNumber("R",254) } if (MorseString:index(Char)==".") { Color:setNumber("R",0) } Color:setNumber("Fire",1) } if (Char>=MorseString:length()) { Send=0 String="" } } if (Send==1) { interval(20) if (Char<String:length() & clk()) { Char++ if (String:index(Char)=="a") {Morse="=.===..."} if (String:index(Char)=="b") {Morse="===.=.=.=..."} if (String:index(Char)=="c") {Morse="===.=.===.=..."} if (String:index(Char)=="d") {Morse="===.=.=..."} if (String:index(Char)=="e") {Morse="=..."} if (String:index(Char)=="f") {Morse="=.=.===.=..."} if (String:index(Char)=="g") {Morse="===.===.=..."} if (String:index(Char)=="h") {Morse="=.=.=.=..."} if (String:index(Char)=="i") {Morse="=.=..."} if (String:index(Char)=="j") {Morse="=.===.===.===..."} if (String:index(Char)=="k") {Morse="===.=.===..."} if (String:index(Char)=="l") {Morse="=.===.=.=..."} if (String:index(Char)=="m") {Morse="===.===..."} if (String:index(Char)=="n") {Morse="===.=..."} if (String:index(Char)=="o") {Morse="===.===.===..."} if (String:index(Char)=="p") {Morse="=.===.===.=..."} if (String:index(Char)=="q") {Morse="===.===.=.===..."} if (String:index(Char)=="r") {Morse="=.===.=..."} if (String:index(Char)=="s") {Morse="=.=.=..."} if (String:index(Char)=="t") {Morse="===..."} if (String:index(Char)=="u") {Morse="=.=.===..."} if (String:index(Char)=="v") {Morse="=.=.=.===..."} if (String:index(Char)=="w") {Morse="=.===.===..."} if (String:index(Char)=="x") {Morse="===.=.=.===..."} if (String:index(Char)=="y") {Morse="===.=.===.===..."} if (String:index(Char)=="z") {Morse="===.===.=.=..."} if (String:index(Char)==" ") {Morse="...."} MorseString=MorseString+Morse } if (Char==String:length()) { MorseString=MorseString+"=.=.=.===.=.===." Send=2 Char=0 interval(1000) } } if ((~Start&Start)|Enter) { Color:setNumber("R",0) Color:setNumber("G",0) Color:setNumber("B",0) Color:setNumber("A",255) Send=1 MorseString="" Enter=Char=0 } if (~Reset&Reset) { Color:setNumber("R",0) Color:setNumber("G",0) Color:setNumber("B",0) Color:setNumber("A",255) MorseString=String="" LastKeyboard=Keyboard=Enter=Char=Send=0 }
e2 Code:
@name Morse In @inputs Color Reset @outputs Receiving PrintString:string CharLength StringClk Morse:string Fail Printing @persist if (Receiving&clk()) { interval(100) if (Color==254) { Morse=Morse+"=" } if (!Color) { Morse=Morse+"." } if (Color & Color!=254) { Morse=Morse+"X" } if (Morse:length()>=15) { if (Morse:right(15)=="=.=.=.===.=.==="|Morse:right(10)=="..........") { Receiving=0 Printing=1 } } } if (~Reset&Reset) { Morse="" Receiving=0 } if (~Color & Color==254 & !Receiving) { interval(50) Receiving=1 Morse="" PrintString="" Printing=Fail=StringClk=0 } if (Printing) { interval(10) if (clk()) { if (Morse:left( 8)=="=.===..." & !CharLength) {Char="A" CharLength=8} elseif (Morse:left(12)=="===.=.=.=..." & !CharLength) {Char="B" CharLength=12} elseif (Morse:left(14)=="===.=.===.=..." & !CharLength) {Char="C" CharLength=14} elseif (Morse:left(10)=="===.=.=..." & !CharLength) {Char="D" CharLength=10} elseif (Morse:left( 4)=="=..." & !CharLength) {Char="E" CharLength=4} elseif (Morse:left(12)=="=.=.===.=..." & !CharLength) {Char="F" CharLength=12} elseif (Morse:left(12)=="===.===.=..." & !CharLength) {Char="G" CharLength=12} elseif (Morse:left(10)=="=.=.=.=..." & !CharLength) {Char="H" CharLength=10} elseif (Morse:left( 6)=="=.=..." & !CharLength) {Char="I" CharLength=6} elseif (Morse:left(16)=="=.===.===.===..." & !CharLength) {Char="J" CharLength=16} elseif (Morse:left(12)=="===.=.===..." & !CharLength) {Char="K" CharLength=12} elseif (Morse:left(12)=="=.===.=.=..." & !CharLength) {Char="L" CharLength=12} elseif (Morse:left(10)=="===.===..." & !CharLength) {Char="M" CharLength=10} elseif (Morse:left( 8)=="===.=..." & !CharLength) {Char="N" CharLength=8} elseif (Morse:left(14)=="===.===.===..." & !CharLength) {Char="O" CharLength=14} elseif (Morse:left(14)=="=.===.===.=..." & !CharLength) {Char="P" CharLength=14} elseif (Morse:left(16)=="===.===.=.===..." & !CharLength) {Char="Q" CharLength=16} elseif (Morse:left(10)=="=.===.=..." & !CharLength) {Char="R" CharLength=10} elseif (Morse:left( 8)=="=.=.=..." & !CharLength) {Char="S" CharLength=8} elseif (Morse:left( 6)=="===..." & !CharLength) {Char="T" CharLength=6} elseif (Morse:left(10)=="=.=.===..." & !CharLength) {Char="U" CharLength=10} elseif (Morse:left(12)=="=.=.=.===..." & !CharLength) {Char="V" CharLength=12} elseif (Morse:left(12)=="=.===.===..." & !CharLength) {Char="W" CharLength=12} elseif (Morse:left(14)=="===.=.=.===..." & !CharLength) {Char="X" CharLength=14} elseif (Morse:left(16)=="===.=.===.===..." & !CharLength) {Char="Y" CharLength=16} elseif (Morse:left(14)=="===.===.=.=..." & !CharLength) {Char="Z" CharLength=14} elseif (Morse:left( 4)=="...." & !CharLength) {Char=" " CharLength=4} elseif (Morse:left(15)=="=.=.=.===.=.===" & !CharLength) {StringClk=1 Printing=0 CharLength=15} else { if (Morse:left(1)=="X" & !Fail) { Char="_" Fail=1 } Morse=Morse=Morse:right(Morse:length()-1) } if (Char) { PrintString=PrintString+Char } Morse=Morse:right(Morse:length()-CharLength) if (CharLength) { Fail=0 } CharLength=0 Char="" if (!Morse) { Printing=0 PrintClk=1 } } }
"If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
-- Niels Bohr
Wire FPGA
You don't know how to read my code.
In morse an dash is equal to 3 times a dot.
I simply coded a dash as ===, a dot as = and silence as a .
A:
=.===... Dot - Silence - Dash - Silence between 2 letters
B:
=... Dot - Silence between 2 letters
Replace the 0's by . , 1's by = and you end up at my code.Originally Posted by wikipedia
Ah, ok. Was trying to read your code, but it didn't make any sense :P
"If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
-- Niels Bohr
Wire FPGA
I'm suprised as to how quickly you guys replied to this. anyway, why are you using "=" rather than "-"?
EDIT: forget I said ^ , it was completely irrelevant to the challenge
Last edited by Jasongamer1; 02-09-2010 at 12:31 PM.
Bookmarks