Created
January 8, 2018 10:18
-
-
Save skynettw/54ce1143b8bbe73c93d0d6f8ff7795f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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