The barcode was inspired by Morse code drawn in the sand.
Why it is true
The inventors scribbled thin and thick lines on the beach to adapt the dots and dashes of Morse code into a format that could be optically read by a machine.
Source: Retail Tech
Would you rather be asked first?
This is the reading side of the site, so the answer is in the sentence above — that is the whole point of it. Test yourself works the other way round: the question comes on its own, and the fact and the explanation only appear once you have answered.