This function controls the LEDs.

Syntax

void GoodReadLed(
  int on_off, 
  int time
);

Parameters

on_off
[in] This parameter can have the following values:
ValueDescription
RED RED LED.
GREEN GREEN LED.
BLUE BLUE LED.
ORANGE GREEN and RED LED's on, resulting in an orange color.
RED_FLASH RED LED flashing.
GREEN_FLASH GREEN LED flashing.
BLUE_FLASH BLUE LED flashing.
ORANGE_FLASH GREEN and RED LED's flashing, resulting in an orange flashing color.
time
[in] 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.
The range of values is 1〜2,147,483,647, or the following values.
The following two values have a special meaning.
ValueDescription
OFF_IMMEDIATELY ( 0 ) The LED will be switched off immediately.
ON_CONTINUOUSLY ( -1 ) The LED will be continuously on.

Return value

None

Remarks

Because the handling of the 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 LED is switched off again.
If you turn on the LEDs of multiple colors, the individual colors will operate independently. However, if ORANGE is specified, both the RED and GREEN LED are turned on.

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include "lib.h"

void main(void)
{
    int x;
    for(;;)
    {
        for (x = 0 ; x < 10 ; x++)
        {
            GoodReadLed(RED, TIME_100MS * 5);
            Delay(TIME_100MS * 10);
            GoodReadLed(GREEN,TIME_100MS * 5);
            Delay(TIME_100MS * 10);
        }
        GoodReadLed(RED, OFF_IMMEDIATELY);
        Delay(TIME_100MS * 40);
        GoodReadLed(GREEN, OFF_IMMEDIATELY);
    }
}

Last updated: 2021/05/01