09 Mission Instructions

5. Code: Overall Structure

Since we will be using variables and lists you will need to go to Advanced Bloxter.

The morse code robot does two different main tasks. First, it listens to the Morse code that you tap into the button. It will silently listen to your entire message before it moves onto the next step.

Then, the robot will repeat back your entire message using the output you've chosen - we're using the built-in eyes in our code examples, but you might choose the LED from Mission 7 or the buzzer from Mission 6 - or something else entirely!

To do this correctly, we'll need to have the robot record your button presses into a list. Then we'll need to program the robot to read that list and act on what it reads.

So, let's start by setting up the overall code structure. Your code needs to include:

      1. Setting up a new list*
      2. Start the timer
      3. Setting up a new loop (let's use the repeat for 15 seconds loop for this program). This first loop will have a conditional statement nested inside of it where we'll fill in some details about whether the button is pressed or not.
      4. A command telling your robot to read over the list it made. (Hint: there will be another conditional in here, too, if you want a head start!)

Here is what our code looks like so far. Is it similar to what you designed?

*To set up a new list, you'll need to create a new variable and give it a name. The variable blocks are in the light blue section. Once you have created your new variable and given it a special name, it will show up as a block to choose in the menu! Ta-Da!