LED

Description

The LED object represents an LED attached to the device. It allows turning on/off or toggling an LED.

This object was introduced in InCore 2.0.

› Inherits:

Object

Overview

Properties

Methods

Signals

Enumerations

Properties

brightness

This property holds the brightness between 0 and 100% which to use when value is true and the corresponding LED is controlled through a PWM.

This property was introduced in InCore 2.6.

› Type:

SignedInteger

› Default:

100

› Signal:

brightnessChanged()

› Attributes:

Writable

index

This property holds the index of the LED which to control through the object instance. If systemName is set, this property is ignored.

› Type:

Index

› Default:

LED.None

› Signal:

indexChanged()

› Attributes:

Writable

networkInterfaceName

This property holds the name of the network interface (i.e. NetworkInterface.hardwareName) which to indicate traffic for.

This property was introduced in InCore 2.5.

› Type:

String

› Signal:

networkInterfaceNameChanged()

› Attributes:

Writable

serialPortName

This property holds the name of the serial port (e.g. ttyUSB0) which to indicate RX/TX activity for.

This property was introduced in InCore 2.5.

› Type:

String

› Signal:

serialPortNameChanged()

› Attributes:

Writable

systemName

This property holds the system name of the LED (i.e. the name of the corresponding entry in /sys/class/leds/) which to control through the object instance. This property takes precedence over index.

This property was introduced in InCore 2.5.

› Type:

String

› Signal:

systemNameChanged()

› Attributes:

Writable

trigger

This property holds a trigger which controls the LED at the system level automatically. See the LED.Trigger enumeration for details.

This property was introduced in InCore 2.5.

› Type:

Trigger

› Default:

LED.NoTrigger

› Signal:

triggerChanged()

› Attributes:

Writable

value

This property holds the desired state of the LED.

› Type:

Boolean

› Default:

false

› Signal:

valueChanged()

› Attributes:

Writable

Methods

shot()

This method triggers the oneshot trigger, i.e. initiates a blinking cycle.

toggle()

This method toggles the current state of the LED, i.e. inverts the value property.

Enumerations

Index

This enumeration describes the supported LED indexes.

Name

Value

Description

LED.None

0

No valid LED configured.

LED.ActivityRed

1

The red activity LED.

LED.ActivityGreen

2

The green activity LED.

LED.StatusRed

3

The red status LED.

LED.StatusGreen

4

The green status LED.

LED.StatusBlue

5

The blue status LED.

Trigger

This enumeration describes the supported triggers for controlling LEDs at the system level. A trigger makes the configured LED flash on certain events or under certain conditions.

This enumeration was introduced in InCore 2.5.

Name

Value

Description

LED.NoTrigger

0

No trigger configured.

LED.Heartbeat

1

A trigger indicating a running system as well as the system load.

LED.StorageAccess

2

A trigger indicating access to the local storage (MMC/NAND).

LED.NetworkTraffic

3

A trigger indicating traffic at a certain network interface (networkInterfaceName).

LED.OneShot

4

A trigger for blinking on single events.

LED.SerialPort

5

A trigger for blinking on on serial port activity.

Example

import InCore.Foundation 2.5
import InCore.IO 2.5

Application {

    LED {
        id: blueLed
        index: LED.StatusBlue
    }

    // toggle blue LED every 1000 ms
    Timer {
        onTriggered: blueLed.toggle()
    }

    AnalogInput {
        id: ain
        index: AnalogInput.AIN1
        mode: AnalogInput.Mode10V
        Polling on value { }
    }

    // turn on red LED if AIN1 exceeds 5 V
    LED {
        index: LED.StatusRed
        value: ain.value > 2048
    }
}