Sound
PLAY
It is possible to play sounds. In the Setup/Peripheral menu, you must configure the speaker or piezo. It can be set to OpenDrain mode, in which case the speaker should be placed between the pin and 3.3V or even 5V for higher volume. The LOW/HIGH/INPUT settings represent the inactive state.
PLAY(RTTTL)#mario.txt
This command plays
Ring Tone Text Transfer Language
(RTTTL) files developed by Nokia from storage. The installer includes ~12,000 ready-made files in the peripherals/SOUND/RTTTL folder.
PLAY(WAV)#pcm0808m.wav
This command plays .wav files from storage. Works only on the RX pin!!! This is a hardware limitation.
It is recommended to use mono 8-bit 8kHz format. A converter program is included in the installer under peripherals/SOUND/WAV/sox.
Usage: sox input.mp3 -r 8000 -c 1 -b 8 output.wav
PLAY!
Stops playback.
PLAY:LED(FLASH)
When the music ends, this command is executed (LED flashes).
BEEP
BEEP(432)
Generates a sound at 432Hz frequency.
BEEP!
Stops the beep.
NUM[0]=1000|
NUM[1]=2000
BEEP(NUM[0],NUM[1])
Generates a 1kHz beep for two seconds.
Examples
BEEP something
TIMER[0]CS:*BEEP(500)|
TIMER[0]CE1:*BEEP(1000)|
TIMER[0]CF:BEEP!|
TIMER[0](100,30x)
Pressing a button plays sound0.txt - sound4.txt.
GPIO[D5]INP|
GPIO[D5]CL:NUM[0]+1|
NUM[0]VL=0|
NUM[0]VH=5|
NUM[0]CH:NUM[0]=VL|
NUM[0]CC:STR[1]=sound;STR[1]>NUM[0];STR[1]>.txt;PLAY(RTTTL)#STR[1]|
PLAY:STD@END