In this sample we show how to play a tune using a buzzer and the PWM interface of the Digi Programmable XBee module.
Here a video with the result:
Direct Link to the Video: LINK
If you can try the sample, here is the source code: LINK
For this sample we are using the PWM API that provides the
SDK delivered with the Digi Programmable XBee:
Pulse-Width Modulation (PWM)
int
|
pwm_config
(xpin_t
pin, bool_t
enable, uint32_t
ton, uint32_t
period)
|
Function
that configures the settings of the Pulse-Width-Modulation module.
|
|
int
|
pwm_enable
(xpin_t
pin, bool_t
enable)
|
Function
that enables/disables the Pulse-Width-Modulation.
|
|
pwm_get_period
(xpin_t
pin)
|
|
Function
that returns the current period for the Pulse-Width-Modulation component.
|
|
pwm_get_ton
(xpin_t
pin)
|
|
Function
that returns the current positive semiperiod for the Pulse-Width-Modulation
component.
|
|
pwm_set_ton
(xpin_t
pin, uint32_t
ton)
|
|
Function
that changes the positive pulse-width of the Pulse-Width-Modulation
component.
|
Thanks to Sebas for the video and the source code!