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