anyone has a clear fritzing graphics on how to connect two PIR sensors with one servo?
I am using the code below:
const int switchPin = 2; // switch input
const int motor1Pin = 3; // H-bridge leg 1 (pin 2, 1A)
const int motor2Pin = 4; // H-bridge leg 2 (pin 7, 2A)
const int enablePin = 9; // H-bridge enable pin
void setup() {
// set the switch as an input:
pinMode(switchPin, INPUT);
// set all the other pins you're using as outputs:
pinMode(motor1Pin, OUTPUT);
pinMode(motor2Pin, OUTPUT);
pinMode(enablePin, OUTPUT);
pinMode(ledPin, OUTPUT);
// set enablePin high so that motor can turn on:
digitalWrite(enablePin, HIGH);
}
void loop() {
// if the switch is high, motor will turn on one direction:
if (digitalRead(switchPin) == HIGH) {
digitalWrite(motor1Pin, LOW); // set leg 1 of the H-bridge low
digitalWrite(motor2Pin, HIGH); // set leg 2 of the H-bridge high
}
// if the switch is low, motor will turn in the other direction:
else {
digitalWrite(motor1Pin, HIGH); // set leg 1 of the H-bridge high
digitalWrite(motor2Pin, LOW); // set leg 2 of the H-bridge low
}
}
(please use the # button to get code tags)
I would connect the PIR’s both to their own pin and merge the signal in software
something like this
const int switchPin1 = 2;  // switch input PIR1
const int switchPin2 = 5;  // switch input PIR2
 const int motor1Pin = 3;  // H-bridge leg 1 (pin 2, 1A)
 const int motor2Pin = 4;  // H-bridge leg 2 (pin 7, 2A)
 const int enablePin = 9;  // H-bridge enable pin
Â
 void setup()
 {
  pinMode(switchPin1, INPUT);
  pinMode(switchPin2, INPUT);
  pinMode(motor1Pin, OUTPUT);
  pinMode(motor2Pin, OUTPUT);
  pinMode(enablePin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  // set enablePin high so that motor can turn on:
  digitalWrite(enablePin, HIGH);
 }
Â
 void loop() {
  // if one of the switches is high, motor will turn on one direction:
  if ((digitalRead(switchPin1) == HIGH) || (digitalRead(switchPin2) == HIGH))
 {
   digitalWrite(motor1Pin, LOW); // set leg 1 of the H-bridge low
   digitalWrite(motor2Pin, HIGH); // set leg 2 of the H-bridge high
  }
  // if the switch is low, motor will turn in the other direction:
  else {
   digitalWrite(motor1Pin, HIGH); // set leg 1 of the H-bridge high
   digitalWrite(motor2Pin, LOW); // set leg 2 of the H-bridge low
  }
 }