Pir

  • Explication

 

  • Prerequisites
    • Dossier partager all user

 

  • Manipulation

 
int pirPin = 12;  
int re = 5;

void setup(){
  Serial.begin(9600);
  pinMode(pirPin, INPUT);
  pinMode(re, OUTPUT);

}
void loop(){

  int val = digitalRead(pirPin);
  Serial.println("Pin");
  Serial.println(pirPin);
  delay(200);
  Serial.println(val);
  delay(200);
  digitalWrite(re, val);
  /*
 if (val = 1) {
    // turn LED on:
    digitalWrite(re, HIGH);
  } else {
    if (val = 0) {
    // turn LED off:
    digitalWrite(re, LOW);
  }
    
  }*/
    
  }
  • Conclusion