Potentiometer: Sound speed

login logout

Potentiometer: Sound frequency

login logout

music_note Change the tune speed


play_circle stop_circle
my_tune = [ ['d5', 0.4], ['d#5', 0.4],
            ['f5', 0.4], ['d6', 0.4]
          ]
                          
for note in my_tune:
  speaker.play(note)
  sleep(dial.value)


bug_report The speed doesn't change

  • Check your code carefully
  • Check you have imported sleep
  • Check you have imported Potentiometer and Speaker
  • Check you have set up the pins

music_note Change the tune frequency


play_circle stop_circle
while True:
  my_note = dial.value * 100 + 20
  speaker.play(my_note)
  sleep(0.1)

lightbulb Midi notes

Multiplying the dial value by 100 then adding 20 gives a value within the range of midi notes.


bug_report I can't hear a sound

  • Check that you have multipied your value by 100 then added 20.
  • Make sure you have imported the Potentiometer and Speaker and set the pin numbers.