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.
-
-
-
It's your turn to try and decode some morse code into words!
-
See if you can work out the sequence of letters in the video using the decoding card.
-
Make sure you get this challenge checked off when you know the answer!
-
-
-
Let's write a program that will send the letter S.
-
In the picture is a program to send 1 dot with the LED. For your wait 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 - your LED module should still be plugged in to A like the last lesson!
-
-
-
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.
-
-
-
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 a do forever loop so it flashes S forever, and add a wait block so there is a gap of seconds between each S.
-
-
-
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.
-
-
-
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 set blocks so it flashes and buzzes the sequence for S.O.S!
-