We have example Python code in voxl-modem to control the B2B GPIO
## All GPIO pins need to be exported before they can be used # def gpio_export(num): subprocess.call("echo " + num + " > /sys/class/gpio/export", stderr=FNULL, shell=True) ## Each GPIO has to have its direction set prior to use # @param num pin number # @param direction 'in' or 'out' # def gpio_direction_map(num, direction): subprocess.call("echo " + direction + " > /sys/class/gpio/gpio" \ + num + "/direction", stderr=FNULL, shell=True) ## Set a value to an 'out' gpio # def set_gpio(num, value): subprocess.call("echo " + value + " > /sys/class/gpio/gpio" + num + "/value", stderr=FNULL, shell=True) ## Reads a GPIO pin # @apram pin # pin number # @return # integer value [0,1] def gpio_read_int(pin_int): gpio_file = '/sys/class/gpio/gpio' + str(pin_int) + '/value' value = subprocess.check_output(['cat', gpio_file]).strip() return int(value)