Hello, Im here with my new photoresistor module sensor, it's looks great but nothing work as always with my new item dispatched!
I connect the 3 pin DOUT to Analog0, GND to GND and Vcc to 5V arduino.
Now I write down these simple code
//Constants
int pResistor = A0; // Photoresistor at Arduino analog pin A0
int ledPin=8; // Led pin at Arduino pin 9
//Variables
int value; // Store value from photoresistor (0-1023)
void setup()
{
pinMode(ledPin, OUTPUT); // Set lepPin - 9 pin as an output
pinMode(pResistor, INPUT);// Set pResistor - A0 pin as an input (optional)
Serial.begin(9600);
}
void loop()
{
value = analogRead(pResistor);
Serial.print("Lumen: ");
Serial.println(value);
//You can change value "25"
if (value > 25)
{
digitalWrite(ledPin, LOW); //Turn led off
}
else{
digitalWrite(ledPin, HIGH); //Turn led on
}
delay(500); //Small delay
}
But nothing work. My module have a screw and when I try to screw or unscrew change only the MAX value I guess from 1020 jump to 24.
I put some screenshot so you can understand better.
Anyone know how can I fix this problem and do sensor reactive to light?
Thanks
Anyways, your sensor isn't dead. It's digital only and appears to be working. Could just use a digital input pin to read the sensor (1 = HIGH, 0 = LOW). Then adjust the potentiometer so it triggers at the desired light level as suggested by knut_ny.
Anyways, your sensor isn't dead. It's digital only and appears to be working. Could just use a digital input pin to read the sensor (1 = HIGH, 0 = LOW). Then adjust the potentiometer so it triggers at the desired light level as suggested by knut_ny.
Tee problem so is the potentiometer that doesn't work!
This night I will try again.
Thank you