Learn how to send morse code messages to apig named Sky.
ð· Meet Sky, the pig! Sky can only communicate using Morse code.
Luckily, you can use your micro:bit with sound to talk to Sky ð
1. From the ðī Input category in the toolbox, drag an ðī on logo [pressed] container into to your workspace.
2. From the Radio category, get radio send number [0] and snap it into your empty on logo [pressed] container.
3. From ðī Input, grab another ðī on logo [pressed] container and add it to your workspace.
ðĄ This container is greyed out because it matches another. Let's change that!
4. On the greyed-out ðī on logo [pressed] container, click on the pressed dropdown and set it to ðīlong pressed.
5. From the Radio category, get a radio send number [0] block and snap it into your empty on logo [long pressed] container. Set the number to be 1.
6. From Radio, find the on radio received [receivedNumber] container and add it to your workspace.
7. From Logic, grab an if <true> then / else statement and snap it into your new on radio received [receivedNumber] container.
8. Go back to the ð Logic category, grab ð <[0] [=] [0]>, and click it in to replace the ð <true> argument in your ð if <true> then / else statement.
9. From your on radio received [receivedNumber] container, grab the receivedNumber input and drag out a copy.
10. Use your copy of receivedNumber to replace the [0] on the left side of ð<[0] [=] [0]>.
11. We want to display a dash if the logo is long pressed. From Basic, grab show leds and snap it into the empty bottom container of your ð if then / else statement.
12. Turn on 3 LEDs in a row to be a dash.
13. From the ð§ Music category, grab a ð§ play tone [Middle C] for [1 beat] [until done] block and snap it at the end of the bottom container in your if then / else statement.
14. We want to display a dotÂ
15. From the Music category, grab ð§ play tone [Middle C] for [1 beat] [until done] and snap it in at the end of the top container in your if then / else statement.
16. Dots are shorter than dashes! Set the tone to play for 1/4 beat.
17. From Basic, find clear screen and snap it in at the very bottom of your on radio received [receivedNumber] container.
Test what you've created. Remember to turn your sound on!
18. Touch the gold micro:bit logo at the top of your micro:bit on the simulator. You'll notice that a second micro:bit appears. This is the micro:bit for Sky ð.
ðĄ If your screen is too small, you might not be able to see it.
19. Touch the logo again to send messages to Sky ð.
Press to send a dot.
Long press (count to 3!)