Madhu here for the weekly post..
I wanted to try out something cool and inexpensive. So I bought this Buzzer online. To make this work I hooked it up to the Arduino PWM signal pins, which runs at around 500 Hz (would be ideal to produce audible tone). I love creating electrical circuits using Fritzing and created this to show the circuit that I used.
For the Simulink part -
Once I found out that Arduino has functions tone and noTone, I set up a S-function builder block in Simulink that shows the library files needed and the calls to these functions appropriately as shown below.
After this I connected a sequence to the enable and frequency inputs of the S-function builder. A total of 15 minutes of work and with the comfort of using Simulink I was able to understand how to use Arduino to control sensors using the PWM pins and also enjoy the music that I created