In this example we show you how to play a tune using a buzzer and the PWM interface of the Digi Programmable XBee module.
Here a video with the result:
Here is the source code used to create the example. For this example we are using the PWM API that provides the SDK delivered with the Digi Programmable XBee:
|
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.
|
|
uint32_t
|
pwm_get_period (xpin_t pin)
Function that returns the current period for the Pulse-Width-Modulation component.
|
|
uint32_t
|
pwm_get_ton (xpin_t pin)
Function that returns the current positive semiperiod for the Pulse-Width-Modulation component.
|
|
uint32_t
|
pwm_set_ton (xpin_t pin, uint32_t ton)
Function that changes the positive pulse-width of the Pulse-Width-Modulation component.
|
Thanks to Sebastian Pastor for the video and the source code!
Happy prototyping! Questions or comments? Let us know!


