query: Who invented the telegraph machine?
passage: Electrical telegraph
Samuel Morse independently developed and patented a recording electric telegraph in 1837. Morse's assistant Alfred Vail developed an instrument that was called the register for recording the received messages. It embossed dots and dashes on a moving paper tape by a stylus which was operated by an electromagnet.[19] Morse and Vail developed the Morse code signalling alphabet. The first telegram in the United States was sent by Morse on 11 January 1838, across two miles (3km) of wire at Speedwell Ironworks near Morristown, New Jersey, although it was only later, in 1844, that he sent the message "WHAT HATH GOD WROUGHT" over the 44 miles (71km) from the Capitol in Washington to the old Mt. Clare Depot in Baltimore.[20][21]
passage: History of telecommunication
On the other side of the Atlantic Ocean, Samuel Morse developed a version of the electrical telegraph which he demonstrated on 2 September 1837. Alfred Vail saw this demonstration and joined Morse to develop the register—a telegraph terminal that integrated a logging device for recording messages to paper tape. This was demonstrated successfully over three miles (five kilometres) on 6 January 1838 and eventually over forty miles (sixty-four kilometres) between Washington, D.C. and Baltimore on 24 May 1844. The patented invention proved lucrative and by 1851 telegraph lines in the United States spanned over 20,000 miles (32,000 kilometres). Morse's most important technical contribution to this telegraph was the simple and highly efficient Morse Code, co-developed with Vail, which was an important advance over Wheatstone's more complicated and expensive system, and required just two wires. The communications efficiency of the Morse Code preceded that of the Huffman code in digital communications by over 100 years, but Morse and Vail developed the code purely empirically, with shorter codes for more frequent letters.