GPIO

Write GPIO in BCM mode

raspberry gpio connection

gpio_out *pin *on|off


Example:

# use (BCM) 17 pin = on
gpio_out 17 on
#
# wait 5 seconds.
sleep 5
#
# use (BCM) 17 pin = off
gpio_out 17 off
#...


Make GPIO PIN object :

gpio_object *ID *type *pin none *pull

*ID = objectID

*type = in

*pin = BCM pin number (1-40)

*pull = pull_up | pull_down


Read GPIO object:

gpio_check *ID *type *condition *value CALL *fnc ELSE *fnc

*id = id_name

*type = in | out

*condition = equal | great | less

*fnc = call to your subfunction script


Example

# -pir input
gpio_object pirID in 14 none none
gpio_check pirID in equal 1 CALL alarm
#
# -button
gpio_object btnID in 23 none pull_up
gpio_check btnID in equal 1 CALL function

# ...

Close the GPIO object

gpio_close *ID


Close the GPIO object

Example:

# ...
gpio_close PIR1
gpio_close PIR2
# ... # ...
Powered by Sgneep.com