Samuel FB Morse devised both the telegraph system and the code. the mode of code- that is dots and dashes was more or less discovered accidentally, the code itself was not. They used printing...
Yes, he invented the telegraphic code for use with his invention. early Morse receivers used clockwork pencils tied in with the juice. Thus, the dot and dash signals were discovered automatically!...
when he was on a ship he herd someone talking about the flow of electricity and thought maybe sound can travel though wires too. so he started working on the Morse code.