When triggered by a PIR a standard servo rotates 90 degrees, an LED is lit, the program pauses 10 seconds, LED Off, a second continious rotation servo rotates for a variable time. The variable time is controlled by a potentimeter. Program ignores the trigger for 15 seconds and then monitors the trigger.
EDIT:
Here's a program to steer you in the right direction - I don't know how to drive a continuous servo:
#include <Servo.h>
Servo servo_normal;
int PIR_pin = 1; // port of the PIR
int pot_pin = 1; // port of the potentiometer
int LED_pin = 1; // port of the LED
int servo_normal_pin = 1; // port of the normal servo
int servo_cont_pin = 1; // port of the continious servo
int pot_value = 0;
int servo_value = LOW;
int servo_normal_value = 0;
void setup() {
servo_normal.write(0);
pinMode(PIR_pin, INPUT);
pinMode(pot_pin, INPUT);
pinMode(LED_pin, OUTPUT);
pinMode(servo_normal_pin, OUTPUT);
pinMode(servo_cont_pin, OUTPUT);
}
void loop() {
servo_value = digitalRead(PIR_pin);
if(servo_value = HIGH){
// motion detected
if(servo_normal_value == 0 || servo_normal_value == 90){
servo_normal_value += 90;
} else{
servo_normal_value = 0;
}
servo_normal.write(servo_normal_value);
digitalWrite(LED_pin, HIGH);
delay(10000);
digitalWrite(LED_pin, LOW);
pot_value = analogRead(pot_pin);
// add the continuous servo part here
delay(15000);
} else{
// this will execute when there is no motion detected
}
}
You will have to add the contuous servo part yourself, as I said, I've never worked with one. Also, be aware that the 'rotate servo 90°' part will do that only once, I programmed it as you asked. However, in the video, it seems like it does that multiple times. This code should do like in the video:
#include <Servo.h>
Servo servo_normal;
int PIR_pin = 1; // port of the PIR
int pot_pin = 1; // port of the potentiometer
int LED_pin = 1; // port of the LED
int servo_normal_pin = 1; // port of the normal servo
int servo_cont_pin = 1; // port of the continious servo
int pot_value = 0;
int servo_value = LOW;
int servo_normal_value = 0;
void setup() {
servo_normal.write(0);
pinMode(PIR_pin, INPUT);
pinMode(pot_pin, INPUT);
pinMode(LED_pin, OUTPUT);
pinMode(servo_normal_pin, OUTPUT);
pinMode(servo_cont_pin, OUTPUT);
}
void loop() {
servo_value = digitalRead(PIR_pin);
if(servo_value = HIGH){
// motion detected
for( int loopvar; loopvar < 10; loopvar++){
if(servo_normal_value == 0 || servo_normal_value == 90){
servo_normal_value += 90;
} else{
servo_normal_value = 0;
}
servo_normal.write(servo_normal_value);
delay(250);
}
digitalWrite(LED_pin, HIGH);
delay(10000);
digitalWrite(LED_pin, LOW);
pot_value = analogRead(pot_pin);
// add the continuous servo part here
delay(15000);
} else{
// this will execute when there is no motion detected
}
}