Skip to main content

Introduction

What if our robot gets in trouble half way across the planet? Let's make a program so it can transmit S.O.S in Morse Code to let us know if its in trouble!

    • Having red/green LEDs is a great start to communicating with our robot

    • What if we want to communicate more than just red or green?

    • Morse Code allows us to send any letter or number we like, just using a single light or buzzer!

    • Watch the video to find out more.

  1. Make sure your robot is setup in the same way as the previous section.
    • Make sure your robot is setup in the same way as the previous section.

    • The red LED should be connected to P1, and the green LED should be connector to P0.

  2. Let's write a program that will send the letter S - this is 3 dots.
    • Let's write a program that will send the letter S - this is 3 dots.

    • In the picture is a program to send 1 dot with the red LED. For your pause blocks, we suggest:

    • 100 milliseconds for a dot

    • 1 second for a dash

    • Extend the program in the picture to send 3 dots, which is an S.

  3. Can you work out how to make the S program shorter?
    • Can you work out how to make the S program shorter?

    • We can use a do _ times loop like we used for moving the robot in a square!

    • Change your program so it sends Morse Code for an S using a loop.

  4. You might have noticed when you were listening to the code, that between the letters we need longer gaps so you can tell when they start and finish.
    • You might have noticed when you were listening to the code, that between the letters we need longer gaps so you can tell when they start and finish.

    • A time of 2 seconds works well.

    • Put your loop that flashes an S inside the forever loop so it flashes S forever, and add a pause block so there is a gap of 2 seconds between each S.

  5. Let's make a program to get our robot to flash SOS using an LED, in case it has a problem. Your program should flash the sequence of dots and dashes required for the letters SOS - for bonus points put it in a loop to make it flash SOS forever!
    • Let's make a program to get our robot to flash SOS using an LED, in case it has a problem.

    • Your program should flash the sequence of dots and dashes required for the letters SOS - for bonus points put it in a loop to make it flash SOS forever!

    • Try to shorten your program using do _ times loops.

    • If you're a bit stuck, have a look in the picture to see which blocks you will need to use.

  6. Using lights for Morse Code is great for  long distances, such as between two ships, but what if you are looking the other way when your robot is in trouble? Replace your LED module with the buzzer module like in the picture, so your robot buzzes SOS instead.
    • Using lights for Morse Code is great for long distances, such as between two ships, but what if you are looking the other way when your robot is in trouble?

    • Replace your LED module with the buzzer module like in the picture, so your robot buzzes SOS instead.

    • If you're feeling really clever, put the LED module back into another output and add some more digital write blocks, so it flashes and buzzes the sequence for S.O.S!

Finish Line

Tech Camp

Member since: 10/03/2012

119 Guides authored

Team

Tech Camp Staff Member of Tech Camp Staff

6 Members

140 Guides authored