Created
March 2, 2016 19:30
-
-
Save SLOLNE/b4bfd0796d30252d1b24 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
Code provided by Tinkernut | |
http://www.tinkernut.com/2014/03/arduino-motion-detecting-squirt-gun/ | |
We didnt change anything in this code | |
const int pirPower = 13; | |
const int pirIn = 12; | |
int motorPin1 = 3; | |
void setup(){ | |
pinMode(pirPower, OUTPUT); | |
pinMode(pirIn, INPUT); | |
pinMode(motorPin1, OUTPUT); | |
digitalWrite(motorPin1, LOW); | |
digitalWrite(pirPower, HIGH); | |
} | |
void loop(){ | |
int value= digitalRead(pirIn); | |
if (value == HIGH){ | |
digitalWrite(motorPin1, HIGH); | |
delay(500); | |
digitalWrite(motorPin1, LOW); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment