Recent Posts
None | 11 sec ago
None | 35 sec ago
None | 1 min ago
None | 1 min ago
C++ | 1 min ago
None | 2 min ago
None | 3 min ago
Power Shell | 3 min ago
None | 3 min ago
None | 3 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
By Anonymous on the 12th of Jan 2010 11:30:57 PM
Download |
Raw |
Embed |
Report
// Troy Watson Arduino Powered Chicken Coop Door
// Waits for the sun to come up, turns a servo to open a drawbridge then waits and closes the bridge.
#include <Servo.h>
Servo servo0; // create servo object
int sensVal = 0; // analog pin used for light sensor
int rotateDeg = 1080; // number of degrees to lower drawbrigde
int darkVal = 55;
void servoUp()
{
servo0.write(rotateDeg); //tells the servo to turn out the winch
}
void servoDown()
{
servo0.write(-1*rotateDeg); //writes the servo to turn back up?
}
void setup()
{
servo0.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
if (sensVal > darkVal){ // duh
delay(360000); // waits 6 minutes
if (sensVal > darkVal){ // checks the sensor again to make sure its really the sun not just some retard in the neighbors driveway
servoDown(); // lets door fall open gracefully
delay(43200000); // waits 12 hours.
servoUp(); // pulls door back up
}
}
}
Submit a correction or amendment below.
[ previous version ] | [ difference ] | Make A New Post