C Language Development Kit/Functions/IsBuzzerOn

From OptiWiki

Jump to: navigation, search
Description This function checks whether the buzzer is currently busy or not.
Syntax
int isBuzzerOn(void);
Arguments None
Returns
0 The buzzer is not busy.
1 The buzzer is busy.
Remarks This function can be used to check whether the beep sequence of the sound() function is finished or not.
Example
#include "lib.h"
#include <stdio.h>
 
void main( void )
{
    while( 1 )
    {
        sound(TSTANDARD, VHIGH, SLOW, SPAUSE, SMEDIUM, SPAUSE, SHIGH, SPAUSE, 0);
 
        while( isBuzzerOn() )
        idle();
 
        sound(TSTANDARD, VHIGH, SHIGH, SPAUSE, SMEDIUM, SPAUSE, SLOW, SPAUSE,0);
 
        while( isBuzzerOn() )
        idle();
    }
}


Views
Personal tools