

Samuel Morse became interested in telegraphy in 1832 and worked out the basics of a relay system in 1835. The equipment was gradually improved and was demonstrated in 1837. Morse developed "Lightning wires" and "Morse Code" and applied for a patent in 1840. (Morse Code- Wikipedia)
Although Samuel Morse invented the telegraph, he lacked technical expertise. He then came into an agreement with Alfred Vail, who built the practical equipment. (Morse Code- Wikipedia)