Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include "Servo.h"
#define SOUT 12
#define PLAYE 11
int value = 0;
Servo m;
void setup() {
m.attach(9);
Serial.begin(9600);
pinMode(SOUT, INPUT);
pinMode(PLAYE, OUTPUT);
digitalWrite(PLAYE, 0);
pinMode(10, OUTPUT);
}
void loop() {
value = analogRead(A2);
if(value>0) {
Serial.println(value);
if(value>400) {
m.write(90);
delay(500);
m.write(180);
delay(500);
Serial.println("---->PIR");
digitalWrite(10, HIGH);
delay(5000);
digitalWrite(10, LOW);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.