GPIO.setIOvalue(GPIOnumber, value)

This method sets the output value of a GPIO pin.

The first input parameter GPIOnumber is a Python integer which is the number of the GPIO.

The second input parameter value is a Python integer which is the output value. It can be 0 or 1.

The return value is a Python integer which is -1 if an error occurred otherwise is 1.

Example:

 

b = GPIO.setIOvalue(4, 1)

 

sets GPIO 4 to output with value 1, assigning the return value to b.

Note: For versions up to 12.00.xx5 this method returns -1 if the GPIOnumber is not set to output.