def runMotor(): # Motor 1 uses Pin 22, Pin 18, Pin 16 motor1 = l293d.DC(22, 18, 16) # Run the motors so visible for i in range(0, 150): motor1.anticlockwise() l293d.cleanup()
def main(): ''' main function''' # Motor 1 uses Pin 22, Pin 18, Pin 16 motor = l293d.DC(22, 18, 16) motor.clockwise(duration=3, speed=25) # Run the motors so visible #for i in range(0,1500): # motor.clockwise() l293d.cleanup()
# Count until the pin goes high while (GPIO.input(pin_to_circuit) == GPIO.LOW): count += 1 return count try: motor = l293d.DC(22, 18, 16) while True: current = db.child("feeder").child("motor").get().val() if current == True: print("Feedr On...") motor.clockwise(duration=3) currentTime = datetime.datetime.fromtimestamp( time.time()).strftime('%Y-%m-%d %H:%M:%S') db.child("feedings").push(currentTime) db.child("feeder").update({"motor": False}) if rc_time(7) < 2000: s.sendmail(INFO.senderEmail, INFO.recipientEmail, message) print("EMAIL SENT!") else: print("Feedr Off..") time.sleep(0.5) except KeyboardInterrupt: pass finally: l293d.cleanup() GPIO.cleanup() print("Thank You For Choosing PetFeedr!")
def close(): logging.info("\nMain : Turning off sensors and motors...\n") GPIO.cleanup() l293d.cleanup() sys.exit(0)