Wednesday, April 4, 2018

Build a Vacation Pet Feeder!

Code:


/* Pet Feeder by William Finucane

 This code is for use with an automatic pet feeder made for the
Mad Science World at http://mad-science.wonderhowto.com/
The feeder uses a gluestick attached to a continuous rotation servo
as a linear actuator. This actuator opens and closes a compartment
of food every 12 hours to feed any domoestic animal

This example code is in the public domain.
*/
#include  

Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created


void setup()
{
  myservo.attach(10);  // attaches the servo on pin 9 to the servo object
}


void loop()
{
                                 
    myservo.write(80);             //open food gate
  delay(10500);                    //at this speed it takes 10.5
                                   //seconds to
                                   //open all the way
  myservo.write(120);              //close food gate
  delay(10000);                    // at this speed it takes 10 seconds
  myservo.write(96);               //hold gate still
  delay(43200000);                  //wait 12 hours
 
  /* the opening of the gate is longer than the closing to make
  sure the glue stick slide never comes out of the case. If the
  feeder is jostled, the extra half a second added upon closeing the
  gate will retighten the slide.
  */
}

2 comments:

  1. I really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people. automatic dog food dispenser with timer

    ReplyDelete
  2. Hi, I want to make the servo motor integrated with the load cell. If the load cell count 0 gram, then the servo motor will start. Can you teach me how to write that code into the arduino? Tq

    ReplyDelete