|
|
Line 176: |
Line 176: |
| | | |
| '''Description:''' [[how to activate blocks|When activated]], this program repeatedly calls the '''Buzzer - Play Song''' block in order to play notes using the '''Repeat''' block. The amount of time allocated to play the song is calculated by the 0.02 second wait times the number of repeats 400. 0.02 second * 400 = 8 seconds. The '''Buzzer - Off''' block MUST be called in order to stop the Buzzer. | | '''Description:''' [[how to activate blocks|When activated]], this program repeatedly calls the '''Buzzer - Play Song''' block in order to play notes using the '''Repeat''' block. The amount of time allocated to play the song is calculated by the 0.02 second wait times the number of repeats 400. 0.02 second * 400 = 8 seconds. The '''Buzzer - Off''' block MUST be called in order to stop the Buzzer. |
− |
| |
− | ==Example 3b: Play a song with Buzzer (Offline Mode)==
| |
Revision as of 23:31, 1 November 2018
Buzzer
Buggy Base contains a Buzzer capable of producing sounds. When pulses of electricity are sent to the Buzzer, the pulses causes the Buzzer to vibrate and produce an audible sound. Pulses of different frequencies will cause the Buzzer to produce different notes. The following blocks will allow the user to control the Buzzer.
Block: Play Note
Buzzer can be controlled to play a note with the Buzzer - Play Note block.
Function: This block controls the Buzzer to play the selected note for the specified duration.
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.
|
Note: As of mDesigner v1.6:
- In "online mode" this block accepts whole and decimal numbers.
- In "offline mode" this block only accepts WHOLE numbers. Decimal numbers will be rounded down.
|
- Note - select note to play.
- Duration - time in seconds to play the selected note.
|
Example 1: Play a note with Buzzer
Description: When activated, Buzzer will play note C4 for 3 seconds.
Example 2: Play a note, pause, play another note, pause, repeat
|
Example
|
|
Description: When activated, Buzzer repeatedly play note C4 (1 second), pause (1 second), play note D4 (1 second), pause (1 second).
Block: Play Song
Buzzer can be controlled to play a note with the Buzzer - Play Note block.
Function: This block controls the Buzzer to play the selected song.
Note: This block's behavior is DIFFERENT between online and offline mode!
|
Note: As of mDesigner v1.6:
- In "online mode" this block is holding. Which means the song must complete playing before the program goes to the next block in the script.
- In "offline mode" this block must be constantly called in order to play each note of the song. A Forever or Repeat block should be used.
|
- Song - selected song to play.
|
Example 3a: Play a song with Buzzer (Online Mode)
Description: When activated, Buzzer will play the selected song.
Example 3b: Play a song with Buzzer (Offline Mode)
Note: this example is performed in offline mode ONLY.
|
|
Example
|
|
Description: When activated, this program repeatedly calls the Buzzer - Play Song block in order to play notes using the Repeat block. The amount of time allocated to play the song is calculated by the 0.02 second wait times the number of repeats 400. 0.02 second * 400 = 8 seconds. The Buzzer - Off block MUST be called in order to stop the Buzzer.