#include <Adafruit_NeoPixel.h>
const byte pir_pin=2;
const byte data_pin=15;
const byte led_num=16;
Adafruit_NeoPixel pixel= Adafruit_NeoPixel(led_num,data_pin,NEO_GRB+NEO_KHZ800);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(pir_pin, INPUT);
pixel.begin();
pixel.show();
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(digitalRead(pir_pin));
if(digitalRead(pir_pin)){
generate_random_pattern();
}
delay(10); //this speeds up the simulation
}
void generate_random_pattern(){
pixel.setPixelColor(0,255,0,0);
pixel.show();
}