Skip to content

Instantly share code, notes, and snippets.

@machinekoder
Created March 6, 2017 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save machinekoder/c45d5d631c3ed818cd5271f214650b61 to your computer and use it in GitHub Desktop.
Save machinekoder/c45d5d631c3ed818cd5271f214650b61 to your computer and use it in GitHub Desktop.
Pilot-API Pinconfig
#!/usr/bin/env python
def exportPin(id):
try:
with open('/sys/class/gpio/export', 'w') as f:
f.write('%i' % id)
except IOError as e:
print(str(e))
try:
with open('/sys/class/gpio/gpio%i/direction' % id, 'w') as f:
f.write('out')
except IOError as e:
print(str(e))
banks = []
banks.append(range(55, 63))
banks.append(range(64, 72))
banks.append(range(73, 79))
for bank in banks:
for pin in bank:
exportPin(pin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment