1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
   | #define PIR_MOTION_SENSOR 2//Use pin 2 to receive the signal from the module
#include <Adafruit_NeoPixel.h>
 
 
 
 
 
#define neoPin 7
#define neoNbr 29
int neoLumin = 300; // Varier cette variable pour modifier la luninosité
 
Adafruit_NeoPixel neoStrip = Adafruit_NeoPixel(neoNbr, neoPin, NEO_GRB + NEO_KHZ800);
 
 
void setup() {
 
 
   pinMode(PIR_MOTION_SENSOR, INPUT);
   Serial.begin(9600); 
 
   neoStrip.begin();
   neoStrip.show();
 
}
 
void loop() {
  Serial.println(PIR_MOTION_SENSOR);
 
  if(digitalRead(PIR_MOTION_SENSOR)){//if it detects the moving people?
 
    for (byte i = 0; i < neoNbr; i++){
      neoStrip.setPixelColor(i, 0,255, 0); // Toutes les LEDs en vert
    }
    neoStrip.show();
 
  }
 
  else{
 
     for (byte i = 0; i < neoNbr; i++){
       neoStrip.setPixelColor(i, 0,0, 250); // Toutes les LEDs en bleu
    }
    neoStrip.show();
 
 
    }
 
} |