Arduino Ladder · Bozoma Innovation Hub

Band 5  ·  Simon Says

Practice  Morse code

Send a message somebody else can actually read. The test is not that it beeps; it is that a person holding the chart can write down what you sent.

Time
35 min
You need
1 buzzer of either kind, or 1 LED and its resistor, 3 jumper wires. A 220Ω resistor as well if your buzzer is the active kind. (A button and millis for the Silver.)
At once
Everybody at once
Before this
Finish Band 5 up to Part 5, where you write your own instructions. No sketch is given.

Sketches for this project

Every file opens with a plain-English header saying what it does and how to wire it, hole by hole.

The job

Send a message somebody else can read

Make the buzzer, or a light, send SOS. Then make it send your own initials.

The test is not that it beeps. The test is that somebody holding the chart, who has not seen your code, can write down what you sent.

Why this is the right place to practise writing your own functions

Morse is two things repeated: a dot and a dash. You will type them dozens of times. Anything you are about to type dozens of times is a function waiting to be written, and this is the smallest, clearest example of that in the whole course.

Band 5 Part 5 showed you how. This page does not show you again.

Think first

The timing is the whole specification

10 min

Morse is not “short beep, long beep”. It is a set of exact ratios, and if you get them wrong nobody can read it, which is the only test that matters.

ThingHow long
A dot1
A dash3
Gap between the parts of one letter1
Gap between two letters3
Gap between two words7

Pick what 1 is worth in thousandths of a second, and everything else follows. Two hundred is a good place to start. Then a dot is 200, a dash is 600, and a letter gap is 600.

The gap everybody forgetsThe silence inside a letter and the silence between letters are different lengths, and that is the only thing telling a listener where one letter stops. Get those two the same and you send one endless letter that nobody can split up. This is the bug to expect.

The letters you need for SOS: S is three dots. O is three dashes.

Build

Build it, then hand it to somebody

25 min
WiringOne buzzer, or one light with its resistor. Band 5 Part 4 for the buzzer, Band 1 Part 5 for the light.

Whichever you pick, the rail needs two wires on it: the part's, and one from that same rail to a GND pin. And the two bands do not use the same rail. Band 1's light works on the top − rail, nearest row j; Band 5's buzzer works on the bottom one, nearest row a. The two strips are not joined to each other, so follow whichever build you chose all the way down, and put the GND wire on the strip your part is actually using.
Either kind of buzzer works here, with one change if yours is activeMorse needs sound and silence rather than a particular note, so both kinds do the job. If yours is passive, use tone and noTone, and Band 5 Part 4's bare wiring is right. If yours is active, digitalWrite is enough — but put a 220 ohm resistor in its pin leg, as Band 3 does, because an active buzzer pulls about thirty thousandths of an amp and a pin is built for twenty.

Not sure which you have? Fit the resistor. It costs a little volume and nothing else.
The check, and it is a personWrite out the chart for the three letters you are sending. Hand it to somebody who has not watched you build this. Run it. They should be able to write down your three letters. If they cannot, your gaps are wrong, and no amount of looking at your own code will show you that.
If there is nobody to hand it toRecord it on your phone. Watch it back tomorrow, with the chart, having half forgotten what you sent. That is a surprisingly honest test, because by then you are a stranger to it.
The shape, if you are stuck
void dot()  { /* on for one unit, off for one unit  */ }
void dash() { /* on for three units, off for one unit */ }
void letterGap() { /* silence, and how long? */ }

Notice that dot and dash each end with their own gap built in. That is a decision, not the only way, and it makes the letter gap shorter than you might expect. Work out by how much.

Change it

Two ways further

Bronze
Send a whole word, with the seven-unit word gap in it, and have a second person read it back. Then halve your unit and see at what speed they stop being able to.
Silver
Go the other way: a button you tap, and the serial monitor prints a dot for a short press and a dash for a long one. You will have to decide where short stops and long starts, and then measure your own tapping to choose it. That is Band 4's calibration lesson arriving in a place nobody expects it. (You need millis to time a press, so come back to this one after Band 5 Part 7. You will also need a button and its wiring from Band 3 Part 3.)
Done

Keep

  • Your chosen unit length, and what a dash and each gap came out as
  • What your reader wrote down, next to what you actually sent
  • Your functions, and one sentence on what you would have typed without them

Ship it

This one is yours. Nobody handed you a sketch for it, so the code in your video is code you wrote. Say that in the post, because it is the difference between somebody who can follow a tutorial and somebody who can build a thing, and it is the difference an employer is looking for.

The four shots as usual, and make the fourth one count: the check this page asked you to run, or the version that did not work first. Put a line of your own code on screen for three seconds. Almost nobody does, and it is the most convincing three seconds in the video.

Show your work has the template. Tag it #BozomaBuilds.