0

Neopixel jewel wont turn on with light sensor

im attempting to connect an LDR with a neopixel jewel and 12 led neopixel, the aim is that when its a dark environment (or below threshold) the neopixel will turn on in blue/red and act as a grow light for a coffee plant. Can anyone assist with the code? this is what i have so far. the neopixel doesnt light up when i move the LDR sensor gauge to dark 

// Light sensor and neopixel LEDs
#include <Adafruit_NeoPixel.h>
#define PIN 6 // connect the data from neopixel ring led to the arduino
#define NUMPIXELS 19 // number of pixels in LED rings
#define SENSOR A0 // connect data from sensor to arduino

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800)

;int sensorValue = 0; // pin that sensor is attached to
;int sensor = 0
;int LED = 6; // Neopixel connected to digital pin 6
;int Light_intensity = 900;

void setup()
{
pixels.begin() ;
pixels.setBrightness (255);
pixels.show();
pinMode(A0,INPUT) ;
pinMode(6,OUTPUT) ;
Serial.begin(9600) ;

}

void loop() {

sensorValue = analogRead(0); //read value from the sensor
Serial.println(sensorValue);
delay(50);

if (sensorValue<Light_intensity){
digitalWrite(6,HIGH);
Serial.println("GROW LIGHT ON, IT'S DARK");
} else {
digitalWrite(6,LOW);

Serial.println("GROW LIGHT OFF, IT'S SUNNY");
}
}

0 comments

Please sign in to leave a comment.