uBit.audio¶
Overview¶
Provides access to playing sounds on the speaker.
API¶
enable¶
int enable()
Description
post-constructor initialisation method
getVolume¶
int getVolume()
Description
Returns
The output volume, in the range 0..255.
setVolume¶
int setVolume( int volume)
Description
Parameters
intvolume - The new output volume, in the range 0..255
Returns
DEVICE_OK on success, or DEVICE_INVALID_PARAMETER
setSpeakerEnabled¶
void setSpeakerEnabled( bool on)
Description
Enable or disable use of the on-board speaker.
on
New value.
Parameters
boolon - New value.
isSpeakerEnabled¶
bool isSpeakerEnabled()
Description
Returns
true if enabled, false otherwise.
setPin¶
void setPin( NRF52Pin & pin)
Description
Define which pin on the edge connector is used for audio.
pin
The pin to use for auxiliary audio.
Parameters
NRF52Pin &pin - The pin to use for auxiliary audio.
setPinEnabled¶
void setPinEnabled( bool on)
Description
Define if audio is enabled on the edge connector pin.
on
New value.
Parameters
boolon - New value.
isPinEnabled¶
bool isPinEnabled()
Description
Returns
true if enabled, false otherwise.
Component Constructor¶
Advanced users only
Do not use this unless you really know what you're doing. It's usually best to use uBit
.
MicroBitAudio( NRF52Pin & pin, NRF52Pin & speaker)
Description
Constructor.
Parameters
NRF52Pin &pinNRF52Pin &speaker