import time import os import sys import RPi.GPIO as GPIO import operator # GPIO pins used MOTORCONTROLPIN = 19 #Feeding Function AmountofFood = 1 motorontime = Anountoffood * 1.75 # Initialize the GPIO system GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) # Initialize the pin for the motor control GPIO.setup(MOTORCONTROLPIN, GPIO.OUT) GPIO.output(MOTORCONTROLPIN, False) from time import localtime, strftime strftime( %H:%M:%S, localtime() if localtime()= 07:00:00 def feednow(): global GPIO global MOTORCONTROLPIN global motorontime if localtime()= 19:00:00 global GPIO global MOTORCONTROLPIN global motorontime
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question