Here is my push button doggy door. I have 1 Arduino UNO board, 1 relay board. AC to 24VDC power supply, 2 push button switches, motion sensor, IAI Electric Cylinder Actuator. The frame is made out of T80 and aluminum. It took some trial and error and some redesigning. But I finally got it.
Below is the first proto type. The threaded rod kept seizing forcing me to re-think my idea.
Code
void setup(){
//start serial connection
Serial.begin(9600);
pinMode(7, INPUT_PULLUP); // Pushbutton
pinMode(13, OUTPUT); // doggydoor Open
pinMode(12,OUTPUT); // Doggy Door shut
}
void loop(){
//read the pushbutton value into a variable
int sensorVal = digitalRead(7);
//print out the value of the pushbutton
Serial.println(sensorVal);
// Keep in mind the pullup means the pushbutton's
// logic is inverted. It goes HIGH when it's open,
// and LOW when it's pressed. Turn on pin 13 when the
// button's pressed, and off when it's not:
if (sensorVal == HIGH) {
digitalWrite(13, LOW);
}
else {
digitalWrite(13, HIGH);
delay(10000);
digitalWrite(12,HIGH);
delay(10000);
}
}
No comments:
Post a Comment