hi guys i am trying to make a simple Ir proximity sensor for a parking sensor .the problem is the analog reading from the 2 pin receiver is always 0 or 1,(i even shined ir directly no change),while the 3pin ir receiver is always 1018,the Ir emitter is working i checked with camera.
can u please check the code and load it into Ur device to see if the receivers are gone or not or is it the code which is the problem
code:-
//pin 0 is intrans
//pin a0 is 2pin receiver out
//pin a1 is pin receiver out
//the ir trans is active low for me
#include <LiquidCrystal.h>
int v=0;
int v1=0;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(0,OUTPUT);
digitalWrite(0,HIGH);
for (int i=0;i<10;i++)//ambilent value
{ v=v+analogRead(A0);
v1=v1+analogRead(A1);
}
v=v/10;v1=v1/10;
lcd.begin(16, 2);
lcd.clear();
lcd.print("sa0=");lcd.print(v);lcd.print("sa1=");lcd.print(v1);
delay(500);
}
void loop()
{
digitalWrite(0,LOW);//trans
delay(50);
int value = analogRead(A0);//read 2pin
int value1 =analogRead(A1);//read 3pin
digitalWrite(0,HIGH);
int value2 = round(value - v);
int v3=round(-value1+v1);
lcd.clear();
lcd.print("a0r=");lcd.print(value);
lcd.print("a1r=");lcd.print(value1);
delay(50);
}
thanks guys