Permalink
Browse files

Update motion_detection/motion_detection/motion_detection.ino

  • Loading branch information...
1 parent b8dc0f4 commit 66fb14c947205d31fb491a1497b911d320eebc5b @mangar committed Jan 10, 2013
Showing with 7 additions and 10 deletions.
  1. +7 −10 motion_detection/motion_detection/motion_detection.ino
@@ -1,23 +1,20 @@
-
int led = 13;
int infraPin = 7;
-// the setup routine runs once when you press reset:
void setup() {
Serial.begin(9600);
pinMode(led, OUTPUT);
pinMode(infraPin, INPUT);
}
-// the loop routine runs over and over again forever:
-void loop() {
-
- Serial.println("lendo....");
- digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
+
+void loop() {
+ Serial.println("reading....");
+ digitalWrite(led, LOW);
if (digitalRead(infraPin)) {
- Serial.println("ATIVO");
- digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
- delay(2000); // wait for a second
+ Serial.println("ACTIVE");
+ digitalWrite(led, HIGH);
+ delay(2000);
}
}

0 comments on commit 66fb14c

Please sign in to comment.