Created
June 17, 2020 15:29
-
-
Save z4yx/cf35bcf8881902efb5d201a9b24c03b3 to your computer and use it in GitHub Desktop.
This file contains 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
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