本文整理汇总了Python中motor.Motor.power方法的典型用法代码示例。如果您正苦于以下问题:Python Motor.power方法的具体用法?Python Motor.power怎么用?Python Motor.power使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类motor.Motor
的用法示例。
在下文中一共展示了Motor.power方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Rfid
# 需要导入模块: from motor import Motor [as 别名]
# 或者: from motor.Motor import power [as 别名]
rfid = Rfid()
rfid.setup()
# Main Loop
while True:
ld.setstate(ld.BOTH)
addr = rfid.getaddr()
if addr:
#print "Address: %s" % addr
found, entry = db.checkaddr(addr)
# Found is the number of entries that occur with address
if found:
ld.setstate(ld.GREEN)
user = entry[USERNAME] # if found > 1, this may log incorrect user. shouldnt happen.
motor.power(ON)
# Hardcoded
# motor.open()
turning = True
while turning:
p0 = encoder.getpulses()
motor.rotate(num_steps=50, speed=0.2)
motor.steps += 50
p1 = encoder.getpulses()
if (p1 - p0) < # clk pulses equivalent to 50 steps
turning = False
sleep(4) # delay between release
steps = motor.steps - 50 # always release less than we take