Telegraph Project from Quick-start Guide runs incorrectly

No. It's a problem with your dit and dah functionality.

I don't have that particular book, so I can't say whether it is correct, but here's the deal for Morse: dits and dahs in a character are separated by delays of dit duration.

So:
For a "dit" The LED should go high for _dit_length, and low for _dit_length.
For a "dah" the LED should go high for _dah_length and low for _dit_length.

To implement this you can make a simple change in your class code:

void Telegraph::output_symbol(const int length) {
    digitalWrite(_output_pin, HIGH);
    delay(length);
    digitalWrite(_output_pin, LOW);
    delay(_dit_length); // davekw7x: This separates the dits and dahs within a character
}

If the class that you posted is directly and correctly copied from the book, then it is obvious that the code wasn't tested. That's not a Good Thing. (See Footnote.)

Regards,

Dave

That fixed it!! Thanks!! It is hard to make something work when the only instructions provided are broken. Apparently the author never had anyone test all the projects right before he sent this manuscript to the publisher. He may have had such a line in his original draft and it may have gotten missed when being transcribed. The sad thing about that is when you print a book, and the information in it is wrong, it stays wrong forever. :slight_smile:

I have examined the page of the book where that piece of the sketch originates, and I did copy it correctly (that line you added was not there).

Now that the sketch and its libraries are working, I plan to study all the code and try to add as many comment lines as I can, describing what each line of code does throughout the entire sketch and its library files. Just as writing about something helps many people sort things out in their mind, adding the comments in my own words has the same effect. The author does discuss "some" of them as he is laying down the code, but there are things I wish he would have talked more about.

I'll keep in mind what you said in your footnote, as well as the other information presented here by others.

Thanks, all of you, for the help. :slight_smile:

Zoandar