Skip to content

Instantly share code, notes, and snippets.

@z4yx
Created Jun 17, 2020
Embed
What would you like to do?
l = ['B7','B6','E20','B5','B3','B2','C3','C0','C1','E22','G0','G2','G4','G5','G3','G1','E21','C2','B0','B1','B4']
n = []
path = '/sys/class/gpio'
for io in l:
num = ord(io[0])-ord('A')
num = num*32+int(io[1:])
n.append(num)
for num in n:
print('echo %d >%s/export'%(num,path))
print('echo out >%s/gpio%d/direction'%(path,num))
print('while true;do ')
for num in n:
print('echo 1 >%s/gpio%d/value'%(path,num))
print('#sleep 1')
print('echo 0 >%s/gpio%d/value'%(path,num))
print('done')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment