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


Python PyMata.get_digital_latch_data方法代码示例

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


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

示例1:

# 需要导入模块: from PyMata.pymata import PyMata [as 别名]
# 或者: from PyMata.pymata.PyMata import get_digital_latch_data [as 别名]
firmata.set_pin_mode(BUTTON_SWITCH, firmata.INPUT, firmata.DIGITAL)

# Arm pin A2 for latching a value >= 678
firmata.set_analog_latch(POTENTIOMETER, firmata.ANALOG_LATCH_GTE, 678)

# Arm pin 12 for latching when the pin goes high
firmata.set_digital_latch(BUTTON_SWITCH, firmata.DIGITAL_LATCH_HIGH)

print "start waiting"
# wait for 5 seconds to allow user interaction with switch and pot
# during this time press and release the switch and turn the pot to maximum

time.sleep(5)

print 'end waiting'
# get and print the digital latched data
print firmata.get_digital_latch_data(BUTTON_SWITCH)

# get and print the analog data latched data
a_latch = firmata.get_analog_latch_data(POTENTIOMETER)
print a_latch
# print gmtime for the time stamp
print time.gmtime(a_latch[firmata.LATCHED_TIME_STAMP])

# wait 2 more seconds and see that the latch entry data is now cleared

time.sleep(2)
print firmata.get_digital_latch_data(BUTTON_SWITCH)
print firmata.get_analog_latch_data(POTENTIOMETER)

firmata.close()
开发者ID:Haobot,项目名称:PyMata,代码行数:33,代码来源:pymata_software_data_latch.py


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