3 gpio.setiodir(gpionumber, value, direction), 4 gpio.getiodir(gpionumber) – Rainbow Electronics GM862-GPS User Manual
Page 39

Easy Script
in Python
80000ST10020a Rev.8 - 01/10/08
Reproduction forbidden without Telit Communications S.p.A. written authorization - All Rights Reserved
page 39 of 100
Return value is a Python integer which is -1 if an error occurred otherwise is input or output value. It is
0 or 1.
Example:
a = GPIO.getIOvalue(5)
gets GPIO 5 input or output value, assigning return value to b.
2.6.3 GPIO.setIOdir(GPIOnumber, value, direction)
Sets direction of a GPIO. First input parameter GPIOnumber is a Python integer which is the number
of the GPIO. Second input parameter value is a Python integer which is the output value. It can be 0
or 1. It is only used if direction value is 1.
NOTE: when the direction value is 1, although the parameter value has no meaning, it is necessary to
assign it one of the two possible values: 0 or 1
Third input parameter direction is a Python integer which is the direction value. It can be 0 for input or
1 for output.
Return value is a Python integer which is -1 if an error occurred otherwise is 1.
Example:
c = GPIO.setIOdir(4, 0, 0)
sets GPIO 4 to input with value having no meaning, assigning return value to c.
2.6.4 GPIO.getIOdir(GPIOnumber)
Gets direction of a GPIO. Input parameter GPIOnumber is a Python integer which is the number of the
GPIO.
Return value is a Python integer which is -1 if an error occurred otherwise is direction value. It is 0 for
input or 1 for output.
Example:
d = GPIO.getIOdir(7)
gets GPIO 7 direction, assigning return value to d.