예제 #1
0
 def setOutValue(pinNumber, value):
     if value == 0:
         cmd = "echo low > " + GPIOCtrl.directionPath(pinNumber)
         ShellCmd.execute(cmd)
     else :
         cmd = "echo high > " + GPIOCtrl.directionPath(pinNumber)
         ShellCmd.execute(cmd)
예제 #2
0
 def setEdge(pinNumber, type):
     cmd = "echo " + type + " > " + GPIOCtrl.baseDir + "gpio" + str(pinNumber) + "/edge"
     ShellCmd.execute(cmd)
예제 #3
0
 def getValue(pinNumber):
     cmd = "cat " + GPIOCtrl.valuePath(pinNumber)
     return ShellCmd.execute(cmd)[0].strip('\n')
예제 #4
0
 def setValue(pinNumber, value):
     cmd = "echo " + str(value) + " > " + GPIOCtrl.valuePath(pinNumber)
     ShellCmd.execute(cmd)
예제 #5
0
 def setOut(pinNumber):
     cmd = "echo out > " + GPIOCtrl.directionPath(pinNumber)
     ShellCmd.execute(cmd)
예제 #6
0
 def setIn(pinNumber):
     cmd = "echo in > " + GPIOCtrl.directionPath(pinNumber)
     ShellCmd.execute(cmd)
예제 #7
0
 def freeGpio(pinNumber):
     if os.path.exists(GPIOCtrl.baseDir + "gpio" + str(pinNumber)) :
         cmd = "echo " + str(pinNumber) + " > " + GPIOCtrl.baseDir + "unexport"
         ShellCmd.execute(cmd)
예제 #8
0
 def requestGpio(pinNumber):
     if os.path.exists(GPIOCtrl.baseDir + "gpio" + str(pinNumber)) :
         return
     cmd = "echo " + str(pinNumber) + " > " + GPIOCtrl.baseDir + "export"
     ShellCmd.execute(cmd)