IR Receiver Question - vs1838b


hi,

i bought ir led , receiver pairs amazon.
i planning on using these basic rpm encoders.

to start have put 5v , gnd across led , pointed @ receiver. have output receiver connected analogue pin 1 , reading pin. receiving 1023 consistently (with occasional fluctuation). see no change if place finger in front of led or remove led.

am going correct way? ideas?

thanks jack. (arduino mega 2560)

code: [select]
const int sensorpin = a1;    // select input pin reciever
const int ledpin = 47;      // select pin led
int sensorvalue = 0;
float voltage = 0.0;

void setup() {
  pinmode(ledpin, output);
  serial.begin(9600);
}

void loop() {
  sensorvalue = analogread(sensorpin);
  voltage = sensorvalue*(5.0/1023.0);
  serial.println(voltage); 
  if (sensorvalue > 500)  //random number - fine tune later
  {
     digitalwrite(ledpin, high); //turn led on when value high
  }
  else
  {
    digitalwrite(ledpin, low);
  }
  delay(100);
}

you have send signal of required frequency, not constant light. receiver output digital, not analogue.


Arduino Forum > Using Arduino > Sensors > IR Receiver Question - vs1838b


arduino

Comments