本文整理汇总了Python中PyMata.pymata.PyMata.stepper_config方法的典型用法代码示例。如果您正苦于以下问题:Python PyMata.stepper_config方法的具体用法?Python PyMata.stepper_config怎么用?Python PyMata.stepper_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyMata.pymata.PyMata
的用法示例。
在下文中一共展示了PyMata.stepper_config方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: signal_handler
# 需要导入模块: from PyMata.pymata import PyMata [as 别名]
# 或者: from PyMata.pymata.PyMata import stepper_config [as 别名]
def signal_handler(sig, frm):
print('You pressed Ctrl+C!!!!')
if firmata is not None:
firmata.reset()
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
# send the arduino a firmata reset
firmata.reset()
# configure the stepper to use pins 9.10,11,12 and specify 512 steps per revolution
firmata.stepper_config(512, [12, 11, 10, 9])
# allow time for config to complete
time.sleep(.5)
# ask Arduino to return the stepper library version number to PyMata
firmata.stepper_request_library_version()
# allow time for command and reply to go across the serial link
time.sleep(.5)
print("Stepper Library Version",)
print(firmata.get_stepper_version())
# move motor #0 500 steps forward at a speed of 20
firmata.stepper_step(20, 500)