C Language Development Kit/Functions/Backlight

From OptiWiki

Jump to: navigation, search
Description This function controls the backlight on the LCD-display.
Syntax
int backlight(int state, short time);
Arguments
int state
One of the following values:
OFF Switches the backlight off, time is ignored.
ON Switches the backlight on, time is ignored.
AUTO Switches the back light on when a key is pressed for time*20 ms.
short time
The time before the backlight is automatically turned off.
Returns None
Example
#include "lib.h"
#include <stdio.h>
 
void main( void )
{
    int c;
 
    while( 1 )
    {
        gotoxy(0,0);
 
        c = getchar();
 
        if( c == F1_KEY )
            backlight( TOGGLE );
        if( c == F2_KEY )
            backlight(ON);
        if( c == F3_KEY )
            backlight( OFF );
        c = backlight( -1 );
        if( c == ON )
            printf("backlight is on ");
        if( c == OFF )
            printf("backlight is off");
        idle();
    }
}


Views
Personal tools