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...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Anonymous on the 12th of Jan 2010 11:30:57 PM Download | Raw | Embed | Report
  1. // Troy Watson Arduino Powered Chicken Coop Door
  2. // Waits for the sun to come up, turns a servo to open a drawbridge then waits and closes the bridge.
  3.  
  4. #include <Servo.h>
  5.  
  6. Servo servo0;  // create servo object
  7.  
  8. int sensVal = 0;  // analog pin used for light sensor
  9. int rotateDeg = 1080;    // number of degrees to lower drawbrigde
  10. int darkVal = 55;
  11.  
  12. void servoUp()
  13. {
  14.   servo0.write(rotateDeg); //tells the servo to turn out the winch
  15. }
  16.  
  17. void servoDown()
  18. {
  19.   servo0.write(-1*rotateDeg);  //writes the servo to turn back up?
  20. }
  21.  
  22. void setup()
  23. {
  24.   servo0.attach(9);  // attaches the servo on pin 9 to the servo object
  25. }
  26.  
  27. void loop()
  28. {
  29.   if (sensVal > darkVal){                      // duh
  30.         delay(360000);                         // waits 6 minutes
  31.         if (sensVal > darkVal){                // checks the sensor again to make sure its really the sun not just some retard in the neighbors driveway
  32.               servoDown();                     // lets door fall open gracefully
  33.               delay(43200000);                 // waits 12 hours.
  34.               servoUp();                       // pulls door back up
  35.         }
  36.   }
  37. }
Submit a correction or amendment below. [ previous version ] | [ difference ] | Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: