DigitalIO¶
Description¶
The DigitalIO object allows reading digital input signal or writing digital output signal.
› Inherits: | Object |
---|
Properties¶
direction¶
This property holds the direction of the IO. This property has to be set to work properly.
› Type: | Direction |
---|---|
› Default: | DigitalIO.Input |
› Signal: | directionChanged() |
› Attributes: | Writable |
error¶
This property holds the most recently occurred error or DigitalIO.NoError if no error occurred. If the same error occurs multiple times this property does not change. Use the errorOccurred() signal to detect multiple occurrences of the same error.
› Type: | Error |
---|---|
› Signal: | errorChanged() |
› Attributes: | Readonly |
errorString¶
This property holds the current human readable error string corresponding to the current value in the error property. It may include additional information such as failure reasons or locations.
› Type: | String |
---|---|
› Signal: | errorStringChanged() |
› Attributes: | Readonly |
index¶
This property holds the index of the IO. This property has to be set to work properly.
› Type: | Index |
---|---|
› Default: | DigitalIO.Invalid |
› Signal: | indexChanged() |
› Attributes: | Writable |
inputValue¶
This property holds the value measured at the digital input if direction is set to DigitalIO.Input and the property has been polled.
This property was introduced in InCore 2.1.
› Type: | Boolean |
---|---|
› Signal: | inputValueChanged() |
› Attributes: | Readonly, Requires Polling |
openDrainFault¶
This property holds the current state of the Open-Drain Fault pin (HUB-GM200 only).
This property was introduced in InCore 2.0.
› Type: | Boolean |
---|---|
› Signal: | openDrainFaultChanged() |
› Attributes: | Readonly, Requires Polling |
outputValue¶
This property holds the value to which the digital output is set if direction is set to DigitalIO.Output.
This property was introduced in InCore 2.1.
› Type: | Boolean |
---|---|
› Default: | false |
› Signal: | outputValueChanged() |
› Attributes: | Writable |
value¶
This property holds the value which to set outputValue to when writing this property or the current value of the inputValue property when reading the property. It is recommended to read or write the direction-specific properties explicitely instead.
› Type: | Boolean |
---|---|
› Default: | false |
› Signal: | valueChanged() |
› Attributes: | Writable, Requires Polling |
Methods¶
pollInputValue()¶
This method polls the inputValue property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.
pollOpenDrainFault()¶
This method polls the openDrainFault property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.
pollValue()¶
This method polls the value property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually. This method only works if direction is set to DigitalIO.Input.
Signals¶
Enumerations¶
Direction¶
This enumeration describes the supported directions for the digital IO interface.
Name | Value | Description |
---|---|---|
DigitalIO.Input |
0 |
The IO is used as an input. |
DigitalIO.Output |
1 |
The IO is used as an output. |
Error¶
This enumeration describes all errors which can occur in DigitalIO objects. The most recently occurred error is stored in the error property.
Name | Value | Description |
---|---|---|
DigitalIO.NoError |
0 |
No error occurred or was detected. |
DigitalIO.HardwareDriverNotAvailable |
1 |
No hardware driver available for the current platform. |
DigitalIO.ConfigurationError |
2 |
Error while configuring DIO pins. |
DigitalIO.OutputError |
3 |
Error while setting the output pin. |
Index¶
This enumeration describes the supported digital input indexes.
Name | Value | Description |
---|---|---|
DigitalIO.Invalid |
0 |
No index assigned. |
DigitalIO.IO1 |
1 |
The 1st digital IO. |
DigitalIO.IO2 |
2 |
The 2nd digital IO. |
DigitalIO.IO3 |
3 |
The 3rd digital IO (only HUB-GM200 and newer). |
DigitalIO.IO4 |
4 |
The 4th digital IO (only HUB-GM200 and newer). |
DigitalIO.IO5 |
5 |
The 5th digital IO (only HUB-GM200 and newer). |
DigitalIO.IO6 |
6 |
The 6th digital IO (only HUB-GM200 and newer). |
Example¶
import InCore.Foundation 2.5
import InCore.IO 2.5
Application {
DigitalIO {
id: digitalInput
index: DigitalIO.IO1
direction: DigitalIO.Input
Polling on inputValue { interval: 100 }
onInputValueChanged: console.log("IO1 changed to", inputValue)
EdgeDetector on inputValue {
onRisingEdge: console.log("Rising edge detected")
}
}
// output inverted signal of digital input
DigitalIO {
id: digitalOutput
index: DigitalIO.IO2
direction: DigitalIO.Output
value: !digitalInput.value
}
}