SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By rajatsharma369007
i have some problem in robot while turning it right. i am using 2 pir sensor and 1 distance sensor. when the right pir is giving signals then the left motor is not responding and it moves only when left pir is also giving signals along with right.
Code: Select all

AF_DCMotor myMotor2(2);
AF_DCMotor myMotor1(1);       
int pirPin2 = 9;
int pirPin1 = 8;

byte motorSpeed = 0;
byte motorSpeedMax = 255;
byte motorSpeedMin = 0;

void setup(){
  pinMode(pirPin1, INPUT);
  pinMode(pirPin2, INPUT);
  digitalWrite(pirPin1, HIGH);
  digitalWrite(pirPin2, HIGH);
void loop(){
if(digitalRead(pirPin2) == HIGH){;
 if(digitalRead(pirPin1) == HIGH){;
 } else{