GPIO built-in module

The GPIO built-in module is an interface between the Python core and the module internal general purpose input output direct handling. The GPIO built-in module is used to set GPIO values and to read GPIO values from the Python script. You can control the GPIO pins also by sending internal 'AT#GPIO' commands using the MDM module, but using the GPIO module is faster because no command parsing is involved, therefore its use is recommended.

Note: The Python core does not verify if the pins are already used for other purposes by other functions, it's the customer responsibility to ensure that no conflict over pins occurs.

If you want to use the GPIO built-in module you need to import it:

 

import GPIO

 

then you can use its methods as in the following example:

 

a = GPIO.getIOvalue(5)

b = GPIO.setIOvalue(4, 1)

 

this reads the GPIO 5 value and sets GPIO 4 to the output with value 1.

More details about GPIO built-in module methods are in the following paragraphs.