Code: Select all
void setup()
{
pinMode(15,INPUT);
Serial.begin(9600);
}
void loop()
{
int v=0;
int a=pulseIn(15,LOW);
if(a>2000)
{
for(int i=0;i<12;i++)
{
if(pulseIn(15,LOW)>1000)//doubt is here
{
v=v+(1<<i);
}
}
Serial.println(v);
delay(500);
}
}