Last active
August 29, 2015 14:13
-
-
Save rodrigosetti/358376263662649ef091 to your computer and use it in GitHub Desktop.
Automatic Cat Feeder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MOTOR_PIN 9 | |
#define FEED_INTERVAL_MS 21600000 // 6 hours | |
#define MOTOR_TIME_MS 1000 // 1 second (about ~ 1/4 cup) | |
void setup() { | |
pinMode(MOTOR_PIN, OUTPUT); | |
} | |
void loop() { | |
feed(MOTOR_TIME_MS); | |
delay(FEED_INTERVAL_MS); | |
} | |
/** | |
* Feed for n milliseconds | |
*/ | |
void feed(unsigned long n) { | |
digitalWrite(motorPin, HIGH); | |
delay(n); | |
digitalWrite(motorPin, LOW); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment