Switch Class: Difference between revisions

Jump to navigation Jump to search
m
→‎getSwitchState(): Adding Documentation on this function
m (Minor Correction (Typo & precision))
m (→‎getSwitchState(): Adding Documentation on this function)
Line 173: Line 173:
Return the actual state of the switch by reading the I/O Device
Return the actual state of the switch by reading the I/O Device
<syntaxhighlight lang="python">
<syntaxhighlight lang="python">
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from FGInterface import FGInterface as FGINT
>>> FGINT1 = FGINT('overheadpanel.cfg')
>>> FGINT1.createDevices()
>>> FGINT1.createElements()
>>> RMP0PWSW = FGINT1.getElement('RMP0PWSW')
>>> RMP0PWSW.getSwitchState()
'0'
>>>
</syntaxhighlight>Set the switch 'On' on the panel<syntaxhighlight lang="python3">
>>> RMP0PWSW.getSwitchState()
'1'
>>>
</syntaxhighlight>Combined with the value typing function <syntaxhighlight lang="python3">
>>> RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())
1
>>> RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())
0
>>>
</syntaxhighlight>
</syntaxhighlight>
534

edits

Navigation menu