09 Mission Instructions

7. Record Your Message, part 2

Since our robot is going to listen to an entire Morse Code message before it repeats it back to us, we'll need to be clear about when exactly it should record a new time in the list.
In the last step, you created a program that could detect when the button was pressed or not pressed, and decided when the timer should reset back to zero. Now we need to decide when the robot should add the timer value to the list.
It actually is quite simple! If we wait until after we reset the timer, the robot will only record a value of zero. Every. Single. Time. That's not very helpful! So, immediately before we reset the timer, let's append to the list the timer value.
How will the robot know when we're done tapping our Morse message? We answer this question in the repeat for the next 15 seconds.. loop. We have 15 seconds to record our message.
If our message is longer than 15 seconds, we'll get cut-off and if our message is shorter than 15 seconds, we'll need to wait the extra seconds until our time is up. Every time you use this code, you'll need to push the button one last time after you think 15 seconds have passed. It won't be part of your repeated message, but it will let the robot know that its time is up!
You can adjust this number however you'd like. If you plan to send short messages, you might need less time. If you plan to send long messages, you might need more time! It's all up to you!

Take a look at our example code below to see how we programmed this solution!