This sketch includes a loop function that is called automatically and repeatedly calls a
flashSequence
function that you wrote, which itself repeatedly calls a flashDotOrDash
function that you wrote, which calls digitalWrite and delay functions that are provided by
Arduino!
This is how your sketches should look. Breaking things up into functions makes it much
easier to get your code working and makes it easier when you return to it after a period of
not using it.
Conclusion
In addition to looking at strings and arrays in this chapter, you have also built this more
complex Morse translator that I hope will also reinforce the importance of building your
code with functions.
In
the next chapter, you learn about input and output,
by which we mean input and
output of analog and digital signals from the Arduino.