本文整理匯總了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