Created
March 6, 2017 18:45
-
-
Save machinekoder/c45d5d631c3ed818cd5271f214650b61 to your computer and use it in GitHub Desktop.
Pilot-API Pinconfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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