Tell us about yourself!

Complete Your Profile
  • DenisZ4 commented on Constructed's instructable Arduino Fish Feeder3 years ago
    Arduino Fish Feeder

    I am using SimpleTimer library for setting up time interval between feedings.In addition I turn off the Servo Motor between feedings so that it doesn't make any noise and also doesn't drain the battery.Hope someone can find this code useful.#include <Servo.h> // create servo object to control a servo#include <SimpleTimer.h>Servo myservo; // create servo object to control a servo// the timer objectSimpleTimer timer;int pos = 0; // variable to store the servo positionvoid setup() { myservo.write(0); Serial.begin(9600); timer.setInterval(86400000, feedMyFish); // Feed every 24 Hours}void feedMyFish() { myservo.attach(9); for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees // in steps of 1 degree myservo.write(pos); // tell ...

    see more »

    I am using SimpleTimer library for setting up time interval between feedings.In addition I turn off the Servo Motor between feedings so that it doesn't make any noise and also doesn't drain the battery.Hope someone can find this code useful.#include <Servo.h> // create servo object to control a servo#include <SimpleTimer.h>Servo myservo; // create servo object to control a servo// the timer objectSimpleTimer timer;int pos = 0; // variable to store the servo positionvoid setup() { myservo.write(0); Serial.begin(9600); timer.setInterval(86400000, feedMyFish); // Feed every 24 Hours}void feedMyFish() { myservo.attach(9); for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees // in steps of 1 degree myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position if (pos == 0) { myservo.detach(); // Turn off Servo motor between feedings } }}void loop() { timer.run();}

    View Instructable »