I want to make a project, OpenMV recognizes the image, and then let the buzzer play the corresponding rhythm according to the result. I want to know if it can be achieved and how to achieve it?
I noticed that OpenMV can also control the frequency, but there is no corresponding example for me to refer to. I only saw examples of using the buzzer to emit high-frequency or low-frequency prompts. I don’t know if OpenMV can make it emit “do re mi fa sol la xi” melody.
In fact, my original idea was to let OpenMV send the recognized information to the Arduino, and then the Arduino would control the buzzer to play the melody, but there was a problem with their communication, and I wanted to reduce the hardware, so I started to think about whether it was possible use OpenMV to control the buzzer directly.
I will be very grateful for your help!
Yes, you just change the frequency of the tone of the buzzer in a timer interrupt. Please see the pyb timer module. With timers you can have an interrupt callback execute to change the tone while the main script runs.
Thank you for such a quick reply!
I want to know what is the relationship between frequency and melody in OpenMV? What the timer module can control is how many hertz it is, but what is the relationship between it and the melody? And can I control the beat of each melody?