Buzzer (use with mDesigner)

From Microduino Wiki
Jump to: navigation, search

The Buzzer is a sound producing trinket which vibrates to produce sounds. Support for this trinket is found in mDesigner.

Compatible Pins

The following pins on the Hub or mCenter+'s Hub support this module:

Hub Digital Pins v2-01.png
Pin Name Compatibility Notes
Pin 0 Yes Not recommended, Pin 0 & 1 used by mDesigner (serial communication).
Pin 1 Yes Not recommended, Pin 0 & 1 used by mDesigner (serial communication).
Pin 2 Yes
Pin 3 Yes
Pin 4 Yes
Pin 5 Yes
Pin 6 Yes
Pin 7 Yes
Pin 8 Yes
Pin 9 Yes
Pin 10 Yes
Pin 11 Yes
Pin 12 Yes
Pin 13 Yes
Pin A0 Yes
Pin A1 Yes
Pin A2 Yes
Pin A3 Yes
Pin A6 Yes
Pin A7 Yes
Pin I2C No


Blocks

Buzzer - Set Frequency

This block sets the Buzzer to produce a sound at the desired frequency (Hz) for the set duration (milliseconds).
If the duration is set to 0, then the Buzzer will continuously be active until a Buzzer - Off block is encountered.

Note: If the duration is set (not 0) this block is holding. Which means the frequency must complete playing before the program goes to the next block in the script.
MDesigner Buzzer Set Frequency.png
  • Pin Number- the pin the Buzzer is connected to.
  • Frequency - the frequency (in Hz) to set the Buzzer to.
  • Duration - the duration (in milliseconds) to play the frequency for.

Buzzer - Play Note

This block sets the Buzzer to play a note for the set duration (seconds).
If the duration is set to 0, then the Buzzer will continuously be active until a Buzzer - Off block is encountered.

Note: If the duration (seconds) is set (not 0) this block is holding. Which means the note must complete playing before the program goes to the next block in the script.
MDesigner Buzzer Play Note.png
  • Pin Number - the pin the Buzzer is connected to.
  • Note - the note to play.
  • Duration - the duration (in seconds) to play the note for.

Buzzer - Play Song

This block sets the Buzzer to play a song from the drop down list.

Note: This block is holding. Which means the song must complete playing before the program goes to the next block in the script.
MDesigner Buzzer Play Song.png
  • Pin Number - the pin the Buzzer is connected to.
  • Song - song selection to play.

Buzzer - Off

This block turns off the Buzzer.

MDesigner Buzzer Off.png


Issues

The Buzzer trinket utilizes a resource called a timer. This can cause issues with analog write (PWM), the IR Receiver, and other functions. Undesired or unintended behavior can occur when this timer resource is being accessed by different things at the same time.