Skip to main content

L7: Review Project

In progress

Excuse our mess while we finish this page! You can contribute here.

Overview​

In this lesson, students will combine everything they have learned so far to build an interactive hearing test device.

The program will:

  • play tones through the buzzer
  • increase the sound frequency step-by-step
  • allow the user to stop the test using a button press
  • display the final frequency

Students will use:

  • variables
  • loops
  • conditions
  • button events
  • timing
  • sound generation

to create a complete interactive project.


Learning Goals​

Students will:

  • combine multiple programming concepts
  • control sound frequencies
  • use variables to track values
  • use loops to sweep frequencies
  • stop a loop using a condition
  • display results on the screen
  • build a complete interactive device

Time Required​

45–60 minutes


Materials​

  • CincoBit or PixoBit
  • USB cable
  • Computer or Chromebook
  • MicroBlocks

Teacher Notes​

This lesson is designed as a project lesson that combines concepts from previous lessons into one complete application.

Students will apply:

  • events
  • variables
  • conditions
  • loops
  • timing
  • sound

in a real interactive system.

This lesson also introduces the idea that:

computers can generate signals at different frequencies.


What is Frequency?​

Frequency describes how fast a sound wave vibrates.

Frequency is measured in:

  • Hertz (Hz)

Examples:

FrequencySound
100 HzLow pitch
1000 HzMedium pitch
5000 HzHigh pitch

Higher frequencies sound higher in pitch.


Human Hearing​

Humans can hear many different frequencies, but hearing ability changes with:

  • age
  • environment
  • volume
  • hearing health

This project explores:

How high of a sound can you hear?


Project Goal​

The hearing test will:

  1. start at a lower frequency
  2. slowly increase the pitch
  3. continue playing sounds in a loop
  4. stop when the user presses a button
  5. display the highest heard frequency

Step 1 — Start the Test​

Create a variable called frequency and then use a when button pressed to set the frequency to zero and enter a forever loop.

Inside the loop, we will change (increase) frequency variable by 200, to then start tone with that frequency.

The loop will continue increasing the frequency forever but we need to slow it down a bit by adding a wait.

hearing test

The say block is very helpful as it shows what frequency is being generated. As the variable increases:

FrequencyResult
500 HzLow tone
1000 HzHigher tone
3000 HzVery high tone
8000 HzExtremely high tone

Students will hear the pitch rise over time.

The forever loop has no way to stop. This will cause the program to run forever, increasing the frequency as it goes! You will need to use the stop button on the top right corner of MicroBlocks.


Step 2 — Stop the Test​

The easiest way to stop the test is by checking if button B was pressed. This polling is done inside the forever loop, no event block will be used.

if button B is pressed, stop tone and scroll text showing the frequency.

hearing test


Concepts Used in This Project​

ConceptHow It Is Used
VariablesStore frequency and stop state
LoopsRepeat frequency sweep
ConditionsUse Polling to stop a loop when button changes
EventsDetect button presses
WaitControl timing
SoundGenerate tones

Understanding Program Flow​

The program follows this sequence:

  1. Start test
  2. Play sound
  3. Increase frequency
  4. Repeat loop
  5. Wait for button press
  6. Stop loop
  7. Display result

This is an example of a complete interactive algorithm.


Try It​

Can you:

  • increase frequency faster
  • slow the sweep down
  • add display animations
  • add a countdown before starting

Real-World Connection​

Frequency testing is used in:

  • hearing exams
  • music production
  • speaker testing
  • communication systems
  • audio equipment

Electronics and computers often generate precise frequencies for testing and measurement.


Troubleshooting​

  • No sound
    • verify buzzer blocks are connected properly
    • check frequency values
  • Frequency changes too quickly
    • increase wait time
  • Test never stops
    • verify the stop condition is correct
  • Display does not show the result
    • ensure display code runs after the loop ends

Vocabulary​

WordMeaning
FrequencyHow fast a sound vibrates
Hertz (Hz)Unit used to measure frequency
SweepGradually changing a value
LoopRepeating instructions
VariableStores changing information

Wrap-Up Question​

Why do loops and variables work well together in projects like this?