C Language Development Kit/Functions/GoodReadLed

From OptiWiki

Jump to: navigation, search
Description This function controls the good read LED.
Syntax
void goodreadled(int on_off, int time);
Arguments
int on_off
This parameter can have the following values:
RED Good read RED LED.
GREEN Good read GREEN LED.
ORANGE GREEN and RED good read LED's on, resulting in an orange color.
RED_FLASH Good read RED LED flashing.
GREEN_FLASH Good read GREEN LED flashing.
ORANGE_FLASH GREEN and RED good read LED's flashing, resulting in an orange flashing color.


(The following colors are only available on the OPH100x)

BLUE Good read BLUE LED.
PURPLE RED and BLUE good read LED's on, resulting in a purple color.
LIGHT_BLUE GREEN and BLUE good read LED's on, resulting in a light blue/green color.
WHITE RED, GREEN and BLUE good read LED's on, resulting in a whitish color.
BLUE_FLASH Good read BLUE LED flashing.
PURPLE_FLASH RED and BLUE good read LED's flashing, resulting in a purple flashing color.
LIGHT_BLUE_FLASH GREEN and BLUE good read LED's flashing, resulting in a light blue/green flashing color.
WHITE_FLASH RED, GREEN and BLUE good read LED's flashing, resulting in a whitish flashing color.
int time
Defines the time the LED is on in steps of 20 milliseconds. After this time the LED will be switched off. For examples, time = 25 specifies half a second. Two values have a special meaning.
0 Good read LED will be switched off immediately.
-1 Good read LED will be continuously on.
Returns None
Remarks Because the handling of the good read LED is done by the operating system,

the terminal will continue executing the application program, during the time the LED is on. After the 'on-time' period has elapsed, the execution is interrupted in order to switch off the LED. Use the delay() function if you want to halt program execution until the good read LED is switched off again.

Example
#include "lib.h"
#include <stdio.h>
 
void main( void )
{
    int x;
 
    while( 1 )
    {
        for( x=0; x < 10; x++)
        {
            goodreadled( RED, 25);
            delay( 50 );
            goodreadled( GREEN, 25);
            delay( 50 );
        #ifdef BLUE
            goodreadled( BLUE, 25);
            delay( 50 );
        #endif
        }
        goodreadled( RED, -1);
        delay( 200 );
        goodreadled( RED, 0);
        goodreadled( GREEN, -1);
        delay( 200 );
        goodreadled( GREEN, 0);
    #ifdef BLUE
        goodreadled( BLUE, -1);
        delay( 200 );
        goodreadled( BLUE, 0);
    #endif
    }
}


Views
Personal tools