cancel
Showing results for 
Search instead for 
Did you mean: 

Need sample code / logic for melody generation on STM8S005 from beep function

RSoni.1
Associate

Hello , I am able to generate the different frequency tones using the beep function. Can anyone guide how to play musical tones let's say happy birthday song on piezo buzzer?

1 REPLY 1
Peter BENSCH
ST Employee

The Standard Peripheral is currently using three fixed beep frequencies 1kHz, 2kHz and 4kHz, because that is often used for signalling using piezo transducers (buzzers).

For more frequencies, e.g. for C major or other scales, the library must be changed accordingly but STMicroelectronics do not provide a ready-made library for this.

Note: For a starting point please take a look at the SPL, especially stm8s_beep.c, stm8s_beep.h and the example BEEP_3SignalsGeneration that you may have already seen.

Good luck!

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.