Puzzles and Adventures in Programming
Posted by sfield on Friday, 15 May 2015
In this section we are going to simply suggest some changes you might make to our first little program. You get to figure out how to make the tiny computer do each task.
- Make the LED flash three short flashes, and then wait a full second before doing it again. Each short flash should be 100 milliseconds long, with a delay of 100 milliseconds between each of the three flashes. See if you can do it all by yourself without looking at the answer.
- Now take that program and change it so that the flashes are three times longer (300 milliseconds), but the delays between the flashes are still 100 milliseconds.
- The first puzzle made the Nano send out the Morse code character 'S' out on the LED. An 'S' is three dots in Morse code. The second puzzle made the Nano send out the letter 'O'. In Morse, the letter 'O' is three dashes. A dash is three times longer than a dot. In between letters in Morse code, there is a pause that lasts as long as a dash (300 milliseconds in our program). Can you write a program that sends out the letters SOS, over and over again, with a full second pause before repeating the next SOS? My answer is getting pretty long -- longer than I would like.