I wrote this example, so I'm excited to hear your feedback. I'll check in regularly and answer questions if any arise.
The example is pretty simple, but it should give you an idea how to use the potentiometer and buzzer easily. The buzzer can be driven audibly at other frequencies, but doesn't have a uniform frequency response. I might add another project demonstrating other frequencies, maybe with volume compensation lookup.
I like this whole series of projects.
I hope that Cypress is going to package the projects into a project tutorial document when you get done.
It would be an awesome document to provide everyone who buys your development board.
Just a thought,
Today’s example project uses the “Danger Shield” which includes a list of hardware features such as three large sliding potentiometers, LEDs, LDR light sensor, push buttons, buzzer, and a 7 segment LED display. The example and descriptions are included in this post.
This example project uses the onboard buzzer along with one of the Linear Potentiometers. The user will slide the potentiometer and control the volume of the Danger Shield buzzer.
Forum Post Attachments:
At the bottom of this post we are including the following items:
- Example Project Zip File
- Zip File of Images
- Project Schematic
- Component Configurations
The user can download the example project at the bottom of this post. The project uses the following list of Creator Components:
- ADC SAR
The components are configured by right clicking on the component in your Top Design schematic view and selecting Configure. Please enable the following selections in the Configuration windows for the listed components above. Attached at the bottom of the post are images of the component configurations.
The main.c firmware is included in the example project. Please review the commented sections for more details.
This example project uses the large A0 Linear Potentiometer on the Danger Shield. The user can slide this potentiometer back and forth controlling the volume of the buzzer. The PSoC 4 uses the ADC SAR component to read the voltage output from the A0 potentiometer and uses that value to control the buzzer volume by changing the duty cycle on the PWM output.
There are no hardware connections outside of connecting the Danger Shield to the Pioneer Kit.
Test Your Project:
Once programmed with this project, you can slide the A0 potentiometer to change the volume on the buzzer.
I hope this example can help you out in your design.