Repeat an SOS Message (using breadboard) Note: This "Repeating an SOS Message" activity is equivalent to the one using an LED module rather than a breadboard. In the previous activity on "Sending an SOS Message," you may have noticed that to create the letter "S" we repeated the code for three dots in a row, and to create the letter "O" we repeated the code for three dashes in a row. In programming we often have situations where we need to do the same sequence of commands multiple times in a row, and so there is a special programming concept known as a "loop" to make it easier to do this. There are several types of loops, but the version we will use in this activity is called a "repeat loop," because it tells the computer how many times to repeat a certain sequence of commands. In RoboBlocky you will find the repeat loop block in the "Loops" section (click the "Loops" button just below the "Logic" button):
The code blocks to be repeated click inside the repeat loop block, and the argument value specifies how many times to repeat the code. We have shown how it works by replacing the "S" code blocks with a repeat loop in the pre-placed blocks, and similarly for the "O" blocks. Your first task is to add the code for the second "S" (see the problem statement). It is also possible to put loops inside of loops. In our SOS example, this feature will be particularly useful if we want to repeat the SOS message more than once. In other words, once we have the code for a single SOS message written using three repeat loops (one for each letter), we can put the whole thing inside another repeat loop and specify the number of times to repeat the SOS message.
|
Grid Size: S M L | Simple View: | MinView: |
Coord: x-axis y-axis | Grid Lines: x-axis y-axis | |||
Grid: | 12x12 inches | 24x24 inches | 36x36 inches | |
72x72 inches | 96x96 inches | 192x192 inches | ||
1x1 inches | 2x2 inches | Fraction: | ||
xy-Range: | ||||
|
||||
|
||||
Quad: | 1 Quadrant | 4 Quadrants | 1&4 Quadrants | |
Units: | US Customary | Metric | Ruler: |
Labels: |
|
|
|
Font
px
|
|
Tics Lines: |
|
Width
px
|
Hash Lines: |
|
Width
px
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
|
Add a third repeat loop to the pre-placed blocks for the second "S" in "SOS". Then put the three repeat loops all inside another repeat loop, and have it repeat the SOS message 5 times. |
|
|
|||||||||||
|
|||||||||||