当前位置: 首页>>代码示例>>Python>>正文


Python InterfaceKit.setOutputState方法代码示例

本文整理汇总了Python中Phidgets.Devices.InterfaceKit.setOutputState方法的典型用法代码示例。如果您正苦于以下问题:Python InterfaceKit.setOutputState方法的具体用法?Python InterfaceKit.setOutputState怎么用?Python InterfaceKit.setOutputState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phidgets.Devices.InterfaceKit的用法示例。


在下文中一共展示了InterfaceKit.setOutputState方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
class phidget:
    def __init__(self, id, port):
        self.id = id
        self.port = port
        self.serial_numbers = (262305, # 4-port, shelf 6
                               262295, # 4-port, shelf 6
                               318471, # 8-port, shelf 2
                               312226, # 8-port, shelf 4
                               259764, # 4-port, shelf 8
                               319749, # 8-port, shelf 10
                               259763, # 4-port, shelf 6
                               )
        self.serial_num = self.serial_numbers[id]
        self.lockfile = "/var/run/lock/phidget-%s.lock" %self.id
        self.lock_fp = open(self.lockfile, "w")
        self.lock_fd = self.lock_fp.fileno()
        fcntl.lockf(self.lock_fd, fcntl.LOCK_EX)
        if debug:
            print "[%.2f] Aquired lock for Phidget %s" %(time.time(), self.id)

        try:
            self.device = InterfaceKit()	
        except RuntimeError as e:
            print("Runtime Error: %s" % e.message)
    
        try:
            self.device.openPhidget(serial=self.serial_num)
        except PhidgetException as e:
            print ("Phidget Exception %i: %s" % (e.code, e.detail))
            fcntl.lockf(self.lock_fd, fcntl.LOCK_UN)
            exit(1)

        self.device.waitForAttach(10000)

        #print ("Phidget %d attached!" % (self.device.getSerialNum()))
        #print ("Phidget has %d inputs, %d outputs, %d sensors"
        #       %(self.device.getInputCount(), self.device.getOutputCount(), self.device.getSensorCount()))

    def close(self):
        self.device.closePhidget()
        fcntl.lockf(self.lock_fd, fcntl.LOCK_UN)
        if debug:
            print "[%.2f] Released lock for Phidget %s" %(time.time(), self.id)

    def on(self):
        self.device.setOutputState(self.port, 1)

    def off(self):
        self.device.setOutputState(self.port, 0)

    def cmd(self, cmd):
        if cmd == 'on':
            self.on()
        if cmd == 'off':
            self.off()
开发者ID:jarsonfang,项目名称:ci-scripts,代码行数:57,代码来源:boot.py

示例2: exit

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
        print "Exiting...."
        exit(1)
    print "Exiting...."
    exit(1)


print "Output Count: "+str(interfaceKit.getOutputCount())

time.sleep(3)

print "Output 0 is currently in state "+str(interfaceKit.getOutputState(0))
print "Press Enter to toggle output 0"
chr = sys.stdin.read(1)
if interfaceKit.getOutputState(0) is False:
    print "setting output dtate to True"
    interfaceKit.setOutputState(0, True)
    print "done"
else:
    print "setting output state to False"
    interfaceKit.setOutputState(0, False)
    print "done"

print "Press Enter to quit...."

chr = sys.stdin.read(1)

print "Closing..."

try:
    interfaceKit.closePhidget()
except PhidgetException, e:
开发者ID:jantman,项目名称:tuxostat,代码行数:33,代码来源:InterfaceKit-simple4.py

示例3: print

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
print('<br>&#169 J J Slabbert')
print('<br><a href="mailto:[email protected]">[email protected]</a><br><br>')

# Create, Open, and Attach the Interface Kit
try:
    ifk = InterfaceKit()
except RuntimeError as e:
    errors = errors + "<h5>Runtime Exception on object creation: " + e.details + "</h5>\n"
try:
    ifk.openPhidget()
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Open: " + e.details + "</h5>\n"
try:
    ifk.waitForAttach(10000)
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Attach: " + e.details + "</h5>\n"
    errors = errors + "<h5>If Phidget is 'Not Physically Attached' it may be in use</h5>\n"

try:
    ifk.setOutputState(4,1)
    print('<font size="16">Digital Output 4 set True</font>')
except:
    print('<font size="16">Error in setting Digital output 4 to True</font>')

print('<br><br><a href="WebInterfaceKit.py">Go back to WebInterfaceKit Main Page. Do not use the browser back button, since the page may not refresh</a>')

print('</body></html>')

ifk.closePhidget()
exit()
开发者ID:njligames,项目名称:SBC,代码行数:32,代码来源:SetTrue4.py

示例4: print

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
print('<br>&#169 J J Slabbert')
print('<br><a href="mailto:[email protected]">[email protected]</a><br><br>')

# Create, Open, and Attach the Interface Kit
try:
    ifk = InterfaceKit()
except RuntimeError as e:
    errors = errors + "<h5>Runtime Exception on object creation: " + e.details + "</h5>\n"
try:
    ifk.openPhidget()
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Open: " + e.details + "</h5>\n"
try:
    ifk.waitForAttach(10000)
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Attach: " + e.details + "</h5>\n"
    errors = errors + "<h5>If Phidget is 'Not Physically Attached' it may be in use</h5>\n"

try:
    ifk.setOutputState(1,0)
    print('<font size="16">Digital Output 1 set False</font>')
except:
    print('<font size="16">Error in setting Digital output 1 to False</font>')

print('<br><br><a href="WebInterfaceKit.py">Go back to WebInterfaceKit Main Page. Do not use the browser back button, since the page may not refresh</a>')

print('</body></html>')

ifk.closePhidget()
exit()
开发者ID:njligames,项目名称:SBC,代码行数:32,代码来源:SetFalse1.py

示例5: print

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
print('<br>&#169 J J Slabbert')
print('<br><a href="mailto:[email protected]">[email protected]</a><br><br>')

# Create, Open, and Attach the Interface Kit
try:
    ifk = InterfaceKit()
except RuntimeError as e:
    errors = errors + "<h5>Runtime Exception on object creation: " + e.details + "</h5>\n"
try:
    ifk.openPhidget()
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Open: " + e.details + "</h5>\n"
try:
    ifk.waitForAttach(10000)
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Attach: " + e.details + "</h5>\n"
    errors = errors + "<h5>If Phidget is 'Not Physically Attached' it may be in use</h5>\n"

try:
    ifk.setOutputState(5,1)
    print('<font size="16">Digital Output 5 set True</font>')
except:
    print('<font size="16">Error in setting Digital output 5 to True</font>')

print('<br><br><a href="WebInterfaceKit.py">Go back to WebInterfaceKit Main Page. Do not use the browser back button, since the page may not refresh</a>')

print('</body></html>')

ifk.closePhidget()
exit()
开发者ID:njligames,项目名称:SBC,代码行数:32,代码来源:SetTrue5.py

示例6: print

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
print('<br>&#169 J J Slabbert')
print('<br><a href="mailto:[email protected]">[email protected]</a><br><br>')

# Create, Open, and Attach the Interface Kit
try:
    ifk = InterfaceKit()
except RuntimeError as e:
    errors = errors + "<h5>Runtime Exception on object creation: " + e.details + "</h5>\n"
try:
    ifk.openPhidget()
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Open: " + e.details + "</h5>\n"
try:
    ifk.waitForAttach(10000)
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Attach: " + e.details + "</h5>\n"
    errors = errors + "<h5>If Phidget is 'Not Physically Attached' it may be in use</h5>\n"

try:
    ifk.setOutputState(7,0)
    print('<font size="16">Digital Output 7 set False</font>')
except:
    print('<font size="16">Error in setting Digital output 7 to False</font>')

print('<br><br><a href="WebInterfaceKit.py">Go back to WebInterfaceKit Main Page. Do not use the browser back button, since the page may not refresh</a>')

print('</body></html>')

ifk.closePhidget()
exit()
开发者ID:njligames,项目名称:SBC,代码行数:32,代码来源:SetFalse7.py

示例7: print

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
print('<br>&#169 J J Slabbert')
print('<br><a href="mailto:[email protected]">[email protected]</a><br><br>')

# Create, Open, and Attach the Interface Kit
try:
    ifk = InterfaceKit()
except RuntimeError as e:
    errors = errors + "<h5>Runtime Exception on object creation: " + e.details + "</h5>\n"
try:
    ifk.openPhidget()
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Open: " + e.details + "</h5>\n"
try:
    ifk.waitForAttach(10000)
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Attach: " + e.details + "</h5>\n"
    errors = errors + "<h5>If Phidget is 'Not Physically Attached' it may be in use</h5>\n"

try:
    ifk.setOutputState(1,1)
    print('<font size="16">Digital Output 1 set True</font>')
except:
    print('<font size="16">Error in setting Digital output 1 to True</font>')

print('<br><br><a href="WebInterfaceKit.py">Go back to WebInterfaceKit Main Page. Do not use the browser back button, since the page may not refresh</a>')

print('</body></html>')

ifk.closePhidget()
exit()
开发者ID:njligames,项目名称:SBC,代码行数:32,代码来源:SetTrue1.py

示例8: print

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
print('<br>&#169 J J Slabbert')
print('<br><a href="mailto:[email protected]">[email protected]</a><br><br>')

# Create, Open, and Attach the Interface Kit
try:
    ifk = InterfaceKit()
except RuntimeError as e:
    errors = errors + "<h5>Runtime Exception on object creation: " + e.details + "</h5>\n"
try:
    ifk.openPhidget()
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Open: " + e.details + "</h5>\n"
try:
    ifk.waitForAttach(10000)
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Attach: " + e.details + "</h5>\n"
    errors = errors + "<h5>If Phidget is 'Not Physically Attached' it may be in use</h5>\n"

try:
    ifk.setOutputState(2,1)
    print('<font size="16">Digital Output 2 set True</font>')
except:
    print('<font size="16">Error in setting Digital output 2 to True</font>')

print('<br><br><a href="WebInterfaceKit.py">Go back to WebInterfaceKit Main Page. Do not use the browser back button, since the page may not refresh</a>')

print('</body></html>')

ifk.closePhidget()
exit()
开发者ID:njligames,项目名称:SBC,代码行数:32,代码来源:SetTrue2.py

示例9: print

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
print('<br>&#169 J J Slabbert')
print('<br><a href="mailto:[email protected]">[email protected]</a><br><br>')

# Create, Open, and Attach the Interface Kit
try:
    ifk = InterfaceKit()
except RuntimeError as e:
    errors = errors + "<h5>Runtime Exception on object creation: " + e.details + "</h5>\n"
try:
    ifk.openPhidget()
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Open: " + e.details + "</h5>\n"
try:
    ifk.waitForAttach(10000)
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Attach: " + e.details + "</h5>\n"
    errors = errors + "<h5>If Phidget is 'Not Physically Attached' it may be in use</h5>\n"

try:
    ifk.setOutputState(5,0)
    print('<font size="16">Digital Output 5 set False</font>')
except:
    print('<font size="16">Error in setting Digital output 5 to False</font>')

print('<br><br><a href="WebInterfaceKit.py">Go back to WebInterfaceKit Main Page. Do not use the browser back button, since the page may not refresh</a>')

print('</body></html>')

ifk.closePhidget()
exit()
开发者ID:njligames,项目名称:SBC,代码行数:32,代码来源:SetFalse5.py

示例10: print

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
print('<br>&#169 J J Slabbert')
print('<br><a href="mailto:[email protected]">[email protected]</a><br><br>')

# Create, Open, and Attach the Interface Kit
try:
    ifk = InterfaceKit()
except RuntimeError as e:
    errors = errors + "<h5>Runtime Exception on object creation: " + e.details + "</h5>\n"
try:
    ifk.openPhidget()
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Open: " + e.details + "</h5>\n"
try:
    ifk.waitForAttach(10000)
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Attach: " + e.details + "</h5>\n"
    errors = errors + "<h5>If Phidget is 'Not Physically Attached' it may be in use</h5>\n"

try:
    ifk.setOutputState(6,0)
    print('<font size="16">Digital Output 6 set False</font>')
except:
    print('<font size="16">Error in setting Digital output 6 to To False</font>')

print('<br><br><a href="WebInterfaceKit.py">Go back to WebInterfaceKit Main Page. Do not use the browser back button, since the page may not refresh</a>')

print('</body></html>')

ifk.closePhidget()
exit()
开发者ID:njligames,项目名称:SBC,代码行数:32,代码来源:SetFalse6.py

示例11: print

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
print('<br>&#169 J J Slabbert')
print('<br><a href="mailto:[email protected]">[email protected]</a><br><br>')

# Create, Open, and Attach the Interface Kit
try:
    ifk = InterfaceKit()
except RuntimeError as e:
    errors = errors + "<h5>Runtime Exception on object creation: " + e.details + "</h5>\n"
try:
    ifk.openPhidget()
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Open: " + e.details + "</h5>\n"
try:
    ifk.waitForAttach(10000)
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Attach: " + e.details + "</h5>\n"
    errors = errors + "<h5>If Phidget is 'Not Physically Attached' it may be in use</h5>\n"

try:
    ifk.setOutputState(3,1)
    print('<font size="16">Digital Output 3 set True</font>')
except:
    print('<font size="16">Error in setting Digital output 3 to True</font>')

print('<br><br><a href="WebInterfaceKit.py">Go back to WebInterfaceKit Main Page. Do not use the browser back button, since the page may not refresh</a>')

print('</body></html>')

ifk.closePhidget()
exit()
开发者ID:njligames,项目名称:SBC,代码行数:32,代码来源:SetTrue3.py

示例12: print

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
print('<br>&#169 J J Slabbert')
print('<br><a href="mailto:[email protected]">[email protected]</a><br><br>')

# Create, Open, and Attach the Interface Kit
try:
    ifk = InterfaceKit()
except RuntimeError as e:
    errors = errors + "<h5>Runtime Exception on object creation: " + e.details + "</h5>\n"
try:
    ifk.openPhidget()
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Open: " + e.details + "</h5>\n"
try:
    ifk.waitForAttach(10000)
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Attach: " + e.details + "</h5>\n"
    errors = errors + "<h5>If Phidget is 'Not Physically Attached' it may be in use</h5>\n"

try:
    ifk.setOutputState(3,0)
    print('<font size="16">Digital Output 3 set False</font>')
except:
    print('<font size="16">Error in setting Digital output 3 to False</font>')

print('<br><br><a href="WebInterfaceKit.py">Go back to WebInterfaceKit Main Page. Do not use the browser back button, since the page may not refresh</a>')

print('</body></html>')

ifk.closePhidget()
exit()	
开发者ID:njligames,项目名称:SBC,代码行数:32,代码来源:SetFalse3.py

示例13: print

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
print('<font size="4">THIS PROJECT WILL DEVELOP IN A FULL FUNCTIONAL WEB APPLICATION TO CONTROL THE PHIDGETS SBC</font>')
print('<br>&#169 J J Slabbert')
print('<br><a href="mailto:[email protected]">[email protected]</a><br><br>')

# Create, Open, and Attach the Interface Kit
try:
    ifk = InterfaceKit()
except RuntimeError as e:
    errors = errors + "<h5>Runtime Exception on object creation: " + e.details + "</h5>\n"
try:
    ifk.openPhidget()
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Open: " + e.details + "</h5>\n"
try:
    ifk.waitForAttach(10000)
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Attach: " + e.details + "</h5>\n"
    errors = errors + "<h5>If Phidget is 'Not Physically Attached' it may be in use</h5>\n"

try:
    ifk.setOutputState(0,1)
    print('<font size="16">Digital Output 0 set True</font>')
except:
    print('<font size="16">Error in setting Digital output 0 to True</font>')

print('<br><br><a href="WebInterfaceKit.py">Go Back to WebInterfaceKit main page. Do not use the browser back button, since the page will not refresh</a>')

print('</body>')
ifk.closePhidget()
exit()
开发者ID:njligames,项目名称:SBC,代码行数:32,代码来源:SetTrue0.py

示例14: print

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
print('<br>&#169 J J Slabbert')
print('<br><a href="mailto:[email protected]">[email protected]</a><br><br>')

# Create, Open, and Attach the Interface Kit
try:
    ifk = InterfaceKit()
except RuntimeError as e:
    errors = errors + "<h5>Runtime Exception on object creation: " + e.details + "</h5>\n"
try:
    ifk.openPhidget()
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Open: " + e.details + "</h5>\n"
try:
    ifk.waitForAttach(10000)
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Attach: " + e.details + "</h5>\n"
    errors = errors + "<h5>If Phidget is 'Not Physically Attached' it may be in use</h5>\n"

try:
    ifk.setOutputState(6,1)
    print('<font size="16">Digital Output 6 set True</font>')
except:
    print('<font size="16">Error in setting Digital output 6 to True</font>')

print('<br><br><a href="WebInterfaceKit.py">Go back to WebInterfaceKit Main Page. Do not use the browser back button, since the page may not refresh</a>')

print('</body></html>')

ifk.closePhidget()
exit()
开发者ID:njligames,项目名称:SBC,代码行数:32,代码来源:SetTrue6.py

示例15: print

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOutputState [as 别名]
print('<br>&#169 J J Slabbert')
print('<br><a href="mailto:[email protected]">[email protected]</a><br><br>')

# Create, Open, and Attach the Interface Kit
try:
    ifk = InterfaceKit()
except RuntimeError as e:
    errors = errors + "<h5>Runtime Exception on object creation: " + e.details + "</h5>\n"
try:
    ifk.openPhidget()
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Open: " + e.details + "</h5>\n"
try:
    ifk.waitForAttach(10000)
except PhidgetException as e:
    errors = errors + "<h5>Phidget Exception on Attach: " + e.details + "</h5>\n"
    errors = errors + "<h5>If Phidget is 'Not Physically Attached' it may be in use</h5>\n"

try:
    ifk.setOutputState(7,1)
    print('<font size="16">Digital Output 7 set True</font>')
except:
    print('<font size="16">Error in setting Digital output 7 to True</font>')

print('<br><br><a href="WebInterfaceKit.py">Go back to WebInterfaceKit Main Page. Do not use the browser back button, since the page may not refresh</a>')

print('</body></html>')

ifk.closePhidget()
exit()
开发者ID:njligames,项目名称:SBC,代码行数:32,代码来源:SetTrue7.py


注:本文中的Phidgets.Devices.InterfaceKit.setOutputState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。