|
Serial Musical Organ 1.0
Buzzer controller and musical organ
|
Organ tone generator interface. More...

Go to the source code of this file.
Functions | |
| void | playNote (uint16_t half_us, uint16_t duration_ms) |
| Play a musical tone. | |
| void | rest (uint16_t duration_ms) |
| void playNote | ( | uint16_t | half_us, |
| uint16_t | duration_ms | ||
| ) |
Play a musical tone.
| half_us | Half period in microseconds (1/(2*frequency)) |
| duration_ms | Tone duration in milliseconds |
Generates a square wave on the buzzer pin. Example: play_note(1136, 500) plays 440Hz for 500ms.
Play a musical tone.
| [in] | half_us | Half period of the square wave in microseconds (1/(2*frequency)) |
| [in] | duration_ms | Total note duration in milliseconds |
This function generates a square wave on the buzzer pin to produce a musical tone. The tone is generated using the following formula:
@bugs For very small half_us (< 10), the generated frequency may be inaccurate due to loop overhead.
Implement hardware timer version for non-blocking playback
Add volume control using PWM modulation
Definition at line 66 of file organ.c.
References BUZZER_PIN, and BUZZER_PORT.
Referenced by main(), and play_twinkle_little_star().
