In 1984, Dave Vernier wrote the book How to Build a Better Mousetrap and 13 other Apple II Projects. The title project of this book was a somewhat whimsical mousetrap that used a photogate placed in a box to detect a mouse and then used a stepper motor to lower the door on the box to catch the mouse. Even though the stepper motor was fairly slow at lowering the door, the trap worked well to catch quite a few mice (or perhaps to catch one mouse many times).
This sketch is for the Arduino version. The stepper motor is attached to the DCU. A pulley on the stepper motor has string wrapped around it. This string goes over a pulley and holding up a vertical sliding door.Â
/* VernierMousetrap (v 2017.07) A Vernier Photogate should also be connnected to the second BTD 1 connector. The sketch monitors this photogate and Controls a stepper motor (unipolar or bipolar) via a Vernier Digital Control Unit (DCU) connected to the BTD 2 connector. This sketch will continuously check the photogate and start the stepper motor rotating when the photogate is blocked. External power must be supplied to the DCU to drive the stepper motor. This version uses the VernierLib library See www.vernier.com/arduino for more information. */ #include "VernierLib.h" VernierLib Vernier; int photogateStatus = HIGH; int stepDelay = 30; //step time in ms int stepCount = 55; //number of stepCount to take int stepDirection = 0; //stepDirection 0 =CW int photogate = 2; //This is the input for a photogate on the BTD 1 connector int LEDpin = 13; /// line for LED to turn on when photogate is blocked void setup() { Serial.begin(9600); // set up Serial library at 9600 bps }// end of setup void loop () { Serial.println(" starting loop, waiting for mouse... "); photogateStatus = digitalRead(photogate);//low when blocked if (photogateStatus == LOW) { digitalWrite(LEDpin, HIGH);// turn on LED Serial.print(photogateStatus); Serial.println(" Blocked "); Vernier.DCUstep(stepCount,stepDirection, stepDelay);// use stepper motor to lower door Vernier.DCU(0);//Turn off all lines delay (10000); //wait 10 seconds, note that the Arduino/shield LED will stay on digitalWrite(LEDpin, LOW);// turn off Arduino/shield LED when ready to trap again } else { Vernier.DCU(0);//Turn off all lines digitalWrite(LEDpin, LOW);// turn off LED } } ;// end of loop
Cookie | Type | Duration | Description |
---|---|---|---|
Chatra | third party | 1 week | Used for chat widget |
CloudFlare (__cfduid) | persistent | 1 month | Used by CloudFlare service for rate limiting |
Cookie Consent: Necessary | session | 12 hours | Used to preserve cookie consent answer for necessary cookies |
Cookie Consent: Non-Necessary | persistant | 1 year | Used to preserve cookie consent answer for non-necessary cookies |
Cookie Consent: Viewed Cookie Policy | persistent | 1 year | Used to remember if user viewed the cookie policy |
Google Analytics (_ga) | persistent | 2 years | Used to distinguish users for Google Analytics |
Google Analytics (_gat) | persistent | 1 minute | Used to throttle request rate of Google Analytics |
Google Analytics (_gid) | persistent | 24 hours | Used to distinguish users for Google Analytics |
PHP Session | session | session | Used to store API results for better performance |
WooCommerce: Cart | temporary | session | Helps WooCommerce determine when cart contents/data changes. |
WooCommerce: Items in Cart | session | session | Helps WooCommerce determine when cart contents/data changes. |
WooCommerce: Session | persistent | 2 days | Helps WooCommerce by creating an unique code for each customer so that it knows where to find the cart data in the database for each customer. |
WordPress: Login Session | persistent, session | Session or 2 weeks (if user clicks remember me) | Used by WordPress to indicate that a user is signed into the website |
WordPress: Secured Account Details | persistent, session | Session or 2 weeks if user chose to remember login | Used by WordPress to securely store account details |
WordPress: Test Cookie | session | Session | Used by WordPress to check if the browser accepts cookies |
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies.