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:
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.
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:
- › Default:
- › 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 |
|---|---|---|
|
|
No valid LED configured. |
|
|
The red activity LED. |
|
|
The green activity LED. |
|
|
The red status LED. |
|
|
The green status LED. |
|
|
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 |
|---|---|---|
|
|
No trigger configured. |
|
|
A trigger indicating a running system as well as the system load. |
|
|
A trigger indicating access to the local storage (MMC/NAND). |
|
|
A trigger indicating traffic at a certain network interface (networkInterfaceName). |
|
|
A trigger for blinking on single events. |
|
|
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
}
}