#include <Adafruit_NeoPixel.h>
#include <PIR.h>
const byte PIR = 35;
const byte dataPin = 32;
const byte LEDNUM = 16;
Adafruit_NeoPixel ring = Adafruit_NeoPixel(LEDNUM, dataPin, NEO_GRB + NEO_KHZ800);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(PIR, INPUT);
ring.begin();
ring.show();
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
if(digitalRead(PIR)){
generateRandPat();
Serial.println("recieved input");
}
delay(10);
}
void generateRandPat() {
byte r = random(0, 255);
byte g = random(0, 255);
byte b = random(0, 255);
for(int i=0; i<LEDNUM; i++){
ring.setPixelColor(i, r, g, b);
ring.show();
delay(50);
}
}