7 - Microbits 3 - loops

7 - Microbits 3 - Iteration

1 / 10
suivant
Slide 1: Diapositive
ComputingLower Secondary (Key Stage 3)

Cette leçon contient 10 diapositives, avec quiz interactifs, diapositives de texte et 1 vidéo.

time-iconLa durée de la leçon est: 50 min

Éléments de cette leçon

7 - Microbits 3 - Iteration

Slide 1 - Diapositive

Key Objectives
All: Know what is meant by Iteration and how to create a loop.

Most: Recognize the usefulness of loops in programming, understand how accessories can be wired to the Microbit.

Some: Understand how to use loops to create a song with Microbit and play a song from the Microbit.

Slide 2 - Diapositive

Slide 3 - Lien

Recall challenge: Musical instrument
The LEDs on a Microbit can also sense light on a scale of 0-255
We can use this to change the pitch of a musical note.

Make the test Microbit play different notes depending on the light it receives.
Include: 
A variable
An if statement

Slide 4 - Diapositive

Solution
You just made a super basic version of a theremin

Slide 5 - Diapositive

Slide 6 - Vidéo



Roll your foil up into two makeshift wires.
 wrap them around the top and bottom metal parts of the headphone jack and connect them to 0 and GND as shown above.

Slide 7 - Diapositive

Write a smash hit!
Use blocks like these to write
 a short tune in sequence.
Write a song with iteration
Music contains loops and patterns. 
The best recording of a riff will often be digitally repeated, rather than played imperfectly over and over
1: Write a short riff in sequence.
2: Place your riff inside a for loop.
3: Manipulate the Index variable to make the riff play twice.
4: Write a second riff in sequence
5. Place that riff in a while loop which repeats twice.
 
Final task: Write a full length song with verses and a chorus.

Slide 8 - Diapositive

What is iteration?
A
A method of structuring data
B
The process of repeating a set of instructions or operations until a specific condition is met
C
The act of combining two or more datasets into one
D
The process of debugging a program to eliminate errors

Slide 9 - Quiz

What did you find most challenging in today's lesson?

Slide 10 - Question ouverte