Skip to content

Commit

Permalink
Updated feeding time for the cats.
Browse files Browse the repository at this point in the history
  • Loading branch information
videoman committed Mar 7, 2014
1 parent c62be8f commit 745b103
Showing 1 changed file with 34 additions and 16 deletions.
50 changes: 34 additions & 16 deletions CatFeeder/Feed_my_cat-button.py
Expand Up @@ -73,7 +73,7 @@ def dual_servo_CW(Servo1PIN,Servo2PIN,SleepTime):
time.sleep(SleepTime)
servo.stop_servo(Servo1PIN)
servo.stop_servo(Servo2PIN)
time.sleep(.25)
#time.sleep(.25)

# This rotates the feeder wheel Counter Clock Wise (from right to left)
def servo_CCW(ServoPIN,SleepTime):
Expand All @@ -82,7 +82,7 @@ def servo_CCW(ServoPIN,SleepTime):
time.sleep(SleepTime)
# Clear servo on Servo1Pin
servo.stop_servo(ServoPIN)
time.sleep(.25)
#time.sleep(.25)

# This rotates both feeder wheels Counter Clock Wise (from right to left)
# at the same time
Expand All @@ -93,7 +93,7 @@ def dual_servo_CCW(Servo1PIN,Servo2PIN,SleepTime):
time.sleep(SleepTime)
servo.stop_servo(Servo1PIN)
servo.stop_servo(Servo2PIN)
time.sleep(.25)
#time.sleep(.25)

# I created a function to feed the "thing" from the approiate side, based
# on the user input. This function calls the servo funcations.
Expand All @@ -114,7 +114,7 @@ def feed_thing(HopperSide,FeedTime):
GPIO.output(BeeperPin, False)
GPIO.output(GPIO_ButtonR_LED_PIN, True)
print "Ok, food is coming out the right bin!"
servo_CCW(Servo2Pin,FeedTime)
servo_CW(Servo2Pin,FeedTime)

if(HopperSide == "Both"):
GPIO.output(GPIO_ButtonL_LED_PIN, False)
Expand Down Expand Up @@ -148,20 +148,30 @@ def feed_thing(HopperSide,FeedTime):

def feed_cat(CatName):
if (CatName == "Thor"):
feed_thing("Right",.5)
time.sleep(.25)
feed_thing("Right",.5)
feed_thing("Right",.6)
time.sleep(.25)
feed_thing("Right",.5)
# feed_thing("Right",.5)
# time.sleep(.25)
# feed_thing("Right",.5)
# time.sleep(.25)
# feed_thing("Right",.5)

if (CatName == "Zelda"):
feed_thing("Left",.5)
time.sleep(.25)
feed_thing("Left",.5)
time.sleep(.25)
feed_thing("Left",.5)
feed_thing("Left",.6)
time.sleep(.25)
feed_thing("Left",.5)
# feed_thing("Left",.8)
# time.sleep(.25)
# feed_thing("Left",.5)
# time.sleep(.25)
# feed_thing("Left",.5)

def feed_time(Feed_hour,Feed_minute):
if time.strftime("%H") == "Feed_hour" and time.strftime("%M") == "Feed_minute":
print "Cat Feeing time!"
feed_cat("Zelda")
time.sleep(1.5)
feed_cat("Thor")
time.sleep(60)

# This is the main loop where we wait for stuff to happen!
while True:
Expand All @@ -186,10 +196,18 @@ def feed_cat(CatName):
elif ( GPIO.input(GPIO_ButtonR_PIN) == True ):
feed_thing("Right",.5)

if time.strftime("%H") == "21" and time.strftime("%M") == "01":
#feed_time("22","10")
if time.strftime("%H") == "20" and time.strftime("%M") == "30":
print "Cat Feeing time!"
feed_cat("Zelda")
time.sleep(1.5)
time.sleep(.5)
feed_cat("Thor")
time.sleep(60)

if time.strftime("%H") == "10" and time.strftime("%M") == "30":
print "Cat Feeing time!"
feed_cat("Zelda")
time.sleep(.5)
feed_cat("Thor")
time.sleep(60)

Expand Down

0 comments on commit 745b103

Please sign in to comment.