Ouverture manuelle par bouton à la place du switch + mise à jour paramètres d'ouverture
This commit is contained in:
parent
9b09ed90cc
commit
a26a275be6
@ -8,7 +8,7 @@
|
||||
//Configuration
|
||||
const float SERVO_SPEED = 0.8;
|
||||
const float OPEN_ANGLE = 10.0;
|
||||
const float CLOSED_ANGLE = 170.0;
|
||||
const float CLOSED_ANGLE = 160.0;
|
||||
|
||||
//Pin definitions
|
||||
#define RED_LED 12
|
||||
@ -24,7 +24,7 @@ const float CLOSED_ANGLE = 170.0;
|
||||
// Others parameters
|
||||
#define SERVO_PWR_TIME 500 //time to stop powering servomotor after the end of move
|
||||
#define DOOR_OPENED_TIME 3000
|
||||
#define IR_DETECTION_THRESHOLD 400
|
||||
#define IR_DETECTION_THRESHOLD 100
|
||||
#define EMPTY_TAG {0,0,0,0,0,0,0,0,0,0,0,0,0,0}
|
||||
#define UNWRITTEN_TAG {255,255,255,255,255,255,255,255,255,255,255,255,255,255}
|
||||
|
||||
@ -418,6 +418,16 @@ void loop() {
|
||||
if (!digitalRead(DOOR_BUTTON)) {
|
||||
Serial.println("Ouverture par l'utilisateur.");
|
||||
door_state = 1;
|
||||
door_servo.attach(SERVO_CTRL);
|
||||
door_servo.write(OPEN_ANGLE);
|
||||
delay(1000);
|
||||
while (digitalRead(DOOR_BUTTON)) {
|
||||
delay(50);
|
||||
}
|
||||
door_servo.write(CLOSED_ANGLE);
|
||||
delay(1000);
|
||||
Serial.println("Fermeture par l'utilisateur.");
|
||||
door_state = 0;
|
||||
}
|
||||
|
||||
if (door_state and !door_move and catIsHere()) {
|
||||
|
Loading…
Reference in New Issue
Block a user