Sound
You can play sounds. Set up the speaker / piezo in the Setup/Peripheral menu. The configured pin operates in OpenDrain mode, so connect the speaker between the pin and 3.3V or higher voltage (5V) for louder sound.
RTTTL
This command plays files in the
Ring Tone Text Transfer Language (RTTTL)
developed by Nokia.
RTTTL#mario.txt
Plays the file mario.txt.
RTTTL!
Stops the playback.
RTTTL:LED(FLASH)
When the music ends, executes the command (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;RTTTL#STR[1]|
RTTTL:STD@END