class Buzzer - passive buzzer


from ezblock import PWM, Buzzer, Music

pwm = PWM("A0")                 # create pwm object
buzzer = Buzzer(pwm)            # create an Buzzer object with PWM object
music = Music()                 # create music object"Low C"), music.beat(1))   # play low C for 1 beat"Middle C#"))              # play middle C sharp                                      # turn buzzer off


class ezblock.Buzzer(pwm) Create an Buzzer object associated with the given pwm object. This allows you to then control buzzer.


  • on - Turn the buzzer on with a square wave

  • off - Turn the buzzer off
  • freq - Set the square wave frequency

  • play - Play freq, set off if a ms delay arguement is provided., ms)