Power-IO Module
- class ClassPowerIO.ClassPowerIO(_address)
- setOutput(output: int, state: int) bool
Sets the output to the given state.
- Parameters:
output – Number of the output which should be set. You can use the constants (
OUT1
,OUT2
, … ,OUT10
orALL
) or integer numbers (1-10 or 255 to set all).state – You can choose whether the Low-Side driver (
OUTPUT_LOW
), the High-Side driver (OUTPUT_HIGH
), or no diver (OUTPUT_OFF
)
- Returns:
True if output was set successfully, False if not.
- Return type:
bool
Example usage:
from testframework import * #ext.init() #only neccessary if you run this code in debug console, outside of a testrun powerIO = ext.getPowerIO(0) powerIO.setOutput(powerIO.OUT1, powerIO.OUTPUT_HIGH)
- getInput(input: int) int
Returns the input value
- Parameters:
input (int) – Number of the input which should be read. You can use the constants (
IN1
,IN2
, … ,IN10
) or integer numbers (1-10).- Returns:
0 if input is low, 1 if input is high (you can also use constants
LOW
orHIGH
), -1 on error- Return type:
int
Example usage:
from testframework import * #ext.init() #only neccessary if you run this code in debug console, outside of a testrun powerIO = ext.getPowerIO(0) in7Value = powerIO.getInput(powerIO.IN7): report.checkBool("Is input low?", in7Value == powerIO.LOW)
- isInputHigh(input: int) bool
Checks if the geiven input has a hihg-level.
- Parameters:
input (int) – Digital intput pin. You can use the constants (
IN1
,IN2
, … ,IN10
) or integer numbers (1-12)- Returns:
True
if the pin is high.False
if the pin is low. Returns None on error
Example usage:
from testframework import * #ext.init() #only neccessary if you run this code in debug console, outside of a testrun powerIO = ext.getPowerIO(0) if powerIO.isInputHigh(powerIO.IN7): print("Its High") else: print("Its Low")
- isInputLow(input: int) bool
See
isInputHigh()