Availability | All terminals | ||||||||||||||||||||||||||||||||
Description | This function sounds one tone or a sequence of tones. | ||||||||||||||||||||||||||||||||
Syntax | void Sound( int time, int vol, ..., 0 ); | ||||||||||||||||||||||||||||||||
Arguments |
int timeThe parameter time defines the time of each tone, in steps of 20 milliseconds. For example, time = 50 is one second. The following constants are defined:
int volThe parameter vol specifies the volume. The following values are possible:
..., 0The last argument "... , 0" contains a sequence of at most 15 tones. The last tone should always be the value zero. Each tone can have one of the following values:
|
||||||||||||||||||||||||||||||||
Returns | None | ||||||||||||||||||||||||||||||||
Remarks |
Program execution will continue while generating the sound sequence. If you want
to execute multiple calls to Sound() consecutively,
or want to wait till the sound is played, use the Delay() function. (It is also possible to use the function IsBuzzerOn() to check whether the buzzer is still busy playing a previous sound or not.) |
||||||||||||||||||||||||||||||||
Example |
#include <stdio.h> #include "lib.h" void main( void ) { for(;;) { Sound(TCLICK, VHIGH, SERROR, SPAUSE, SLOW, SPAUSE, SMEDIUM, SPAUSE, SHIGH,0); Delay(200); // Wait 4 sec Sound(TSTANDARD, VMEDIUM, SERROR, SPAUSE, SLOW, SPAUSE, SMEDIUM, SPAUSE, SHIGH,0); Delay(200); Sound(TLONG, VLOW, SERROR, SPAUSE, SLOW, SPAUSE, SMEDIUM, SPAUSE, SHIGH,0); Delay(200); Sound(TVLONG, VSYSTEM, SERROR, SPAUSE, SLOW, SPAUSE, SMEDIUM, SPAUSE, SHIGH, 0); Delay(200); } } |