Build on yesterdayβs example and use the buzzer of the generic node to make a buzz! π£
Here is a picture of the generic node again. Its a piece of hardware with an STM32WL5x and has a bunch of sensors and actuators
as well as the possibility to use LoRaWAN.
Solution
Lets start from a template again, same folder as yesterday.
The template, looks like this, when running tree -L 3
To run tests we run DEFMT_LOG=info cargo test -p testsuite --target thumbv7em-none-eabi --bin pka.
To keep things simple, we will add an additional example, instead of doing something complicated. The buzzer is a βPiezo speaker - provides audible feedback.β According to the documentation
it is connected to PA15 - internally connected to the piezo speaker. The schematic can be found under following link. The relevant part looks as follows.
The datasheet of the buzzer MLT-7525 shows that the oscillation frequency is 2700Hz which you can listen to onyoutube - it sounds annoying.
. So we must toggle the output at the resonant frequency of 2700 Hz, which means we need to toggle the GPIO every 185e-6 seconds. This means we toggle -> delay_us(185)permantently to activate the buzzer if we do it very simply and in a blocking manner.
And here we have it the result running on the target: