- Name:
- sound
- Syntax:
-
SOUND pin,(note,duration,note,duration...)
Pin - is a variable/constant which specifies the i/o pin to use.
Note(s) - are variables/constants (0-255) which specify type and frequency. Note 0 is silent for the duration. Notes 1-127 are ascending tones. Notes 128-255 are ascending white noises.
Duration(s) - are variables/constants (0-255) which specify duration (multiples of approx 10ms).
- Description:
-
Play sound 'beep' noises. This command is designed to make audible 'beeps' for games and keypads etc. To play music use the play or tune command instead.
Note and duration must be used in 'pairs' within the command.
Effect of Increased Clock Speed:
The length of the note is halved at 8MHz and quartered at 16MHz.
Play a sequence of sounds
Play a sound on output B.7 then play the next higher sound frequency
- Code Example:
-
main: let b0 = b0 + 1 ; increment b0 sound B.7,(b0,50) ; make a sound goto main ; loop back to start
Copy Code Submit an Example
Submit Your Own Code!
You must be logged in to submit code examples. Login now.