The Ultrasonic Theremin

A theremin is a musical instrument that plays notes according to where the musician’s hands are. It has been around since about 1929 and this tutorial looks at how to make an mBot Theremin, using the ultrasonic sensor.


If an object is less than 10cm away
---- Play a high note
Else If an object is less than 20cm away
---- Play a lower note
Else If an object is less than 30cm away
---- Play a lower note
Else If...

The start of my code looks like this:

code

Challenge:

  1. Can you finish off the program? Make it as long or as short as you want, and then get playing your theremin.
  2. The higher notes play more quickly than the lower notes. Why is that? Can you change the program so that the notes all play at the same speed?

Construct Your Dreams!