On May 24, 1844 Samuel F. B. Morse transmitted the first message on a United States experimental telegraph line (Washington to Baltimore) using the “Morse code” that became standard in the United States and Canada. The message, taken from the Bible, Numbers 23:23, and recorded on a paper tape, had been suggested to Morse by Annie Ellworth, the young daughter of a friend. It was “What hath God wrought?” The recipient of Morse's message was Morse's associate in developing the telegraph, machinist and inventor Alfred Vail.
Vail, who had worked with Morse since September 1837, expanded Morse's original experimental numeric code based on a optical telegraph codes, to include letters and special characters, so it could be used more generally. Vail determined the frequency of use of letters in the English language by counting the movable type he found in the type-cases of a local newspaper in Morristown. The shorter marks were called "dots", and the longer ones "dashes", and the letters most commonly used were assigned the shorter sequences of dots and dashes. Vail was thus responsible for inventing the most useful and efficient features of the Morse Code.
The Morse Code became the first widely used data code.
Probably the first publication of the Morse Code was in Vail's Description of the American ElectroMagnetic Telegraph: Now in Operation between the Cities of Washington and Baltimore (1845). Vail issued two versions of this in 1845: a 24-page pamphlet, which was probably the first, and a much-expanded 208-page book.
Hook & Norman, Origins of Cyberspace (2002) no. 208.