Created
May 26, 2020 12:53
-
-
Save vaishnavachath/b822efd8b9120c1aa15129272d029138 to your computer and use it in GitHub Desktop.
mikroBUS driver test on Techlab Cape
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
import time | |
import os | |
# configure the buttons on Techlab Cape as GPIO | |
os.system("config-pin p1.29 gpio") | |
os.system("config-pin p2.33 gpio") | |
flag=0 | |
while True: | |
with open('/sys/class/gpio/gpio45/value', 'r') as infile: | |
buttonl=int(infile.readline()) | |
with open('/sys/class/gpio/gpio117/value', 'r') as infile: | |
buttonr=int(infile.readline()) | |
if(not(buttonr) and flag==1): | |
flag=0 | |
os.system("echo 0 > /sys/class/mikrobus-port/mikrobus-0/delete_device") | |
elif(not(buttonl) and flag==0): | |
flag=1 | |
os.system("echo 1 > /sys/class/mikrobus-port/mikrobus-0/rescan") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment