2

Hello I'm working on a project using parallax IR sensors and an arduino uno when I program it using this program:

void setup()
{
    Serial.begin(9600);

    /*IR Recievers*/
    pinMode(2, INPUT);
    pinMode(3, INPUT);
    pinMode(4, INPUT);

    /*IR Emitters*/
    pinMode(8, OUTPUT);
    pinMode(9, OUTPUT);
    pinMode(10, OUTPUT);
}

void loop()
{
    int i = 2;
    for(int j =8; j <= 10; j++)
    {
        tone(j, 38000);
        Serial.println(digitalRead(i));
        noTone(j);
        i++
    }
}

If I use this same code for just 1 receiver it works fine. However when I use any more than 1, it can't detect changes in infrared. Does anyone have a solution or know what might be causing this?

OhBeWise
  • 5,350
  • 3
  • 32
  • 60

0 Answers0