So, a while back i made this thread:
http://forum.arduino.cc/index.php?topic=527467.0
Made it work, tore it up and put it away. Now i'm back at it and I can't get it to work anymore.
The sketch:
For some reason, the image is not working so here is the link:
The Code
#include <SoftwareSerial.h>
int ldrPin = 1;
int tonePin = 11;
int digitalReadLDR = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(ldrPin, INPUT);
pinMode(tonePin, OUTPUT);
tone(tonePin, 36000);
}
void loop() {
// put your main code here, to run repeatedly:
digitalReadLDR= digitalRead(ldrPin);
Serial.println(digitalReadLDR);
delay(500);
}
Now, the resistor is a 220 ohm resistor and the sensor is a tsop2236
Datasheet: https://hackerstore.nl/PDFs/IROntvanger.pdf
The LDR datasheet:
(I might have switched the + and minus poles in the sketch, not in the physical system though)
Now, the problem:
The monitor shows that the value is always 1 (high) as if the LDR is turned on. However, even when I disconnect the LDR it still shows 1 in the monitor as input.
For some reason, image is not working so here the link:
The most simple explanation that saves my own credit, is the sensor busted?
The more logic reason, I am doing something wrong, but what?