/* * Starting and stopping NeoPixels with an IR proximity sensor. * Adapted from: https://learn.adafruit.com/neopixel-painter/test-neopixel-strip * */ #include #define PIN 6 #define N_LEDS 33 const int IRPin2 = 16; // no. of LED pin const long TIMEINTERVAL = 5000; // the time it takes for the LEDs to light up const int DIODETHRESHOLD = 982; // the strenght of the IR LEDs long timerstart; Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_LEDS, PIN, NEO_GRB + NEO_KHZ800); void setup() { timerstart=0; pinMode(IRPin2, INPUT); strip.begin(); strip.show(); // Turn OFF all pixels strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255) } void loop() { if (millis()-timerstart>TIMEINTERVAL){ blink(); } //stop blinking if I detect something in the IR int photodiode = analogRead(IRPin2); if(photodiode