How to add multiple laser receivers to Arduino inputs?

/I’m using the following code to detect a laser beam trip wire, however I’m having an issue adding additional laser receivers to A1-A5. I’m using a keypad to reset alarm and a 5v relay to activate lasers, alarms and strobe light. I’m new to all this and could use some direction. Thanks in advance!/

#include <Keypad.h>

#define Rec 0
#define Laser 2
#define Relay 12

bool detection;
short a=0;
short code[4]={'0','0','0','0'};  

const byte numRows= 4;            
const byte numCols= 4;

char keymap[numRows][numCols]=    
         {
         {'1', '2', '3', 'A'}, 
         {'4', '5', '6', 'B'}, 
         {'7', '8', '9', 'C'},
         {'*', '0', '#', 'D'}
         };

byte rowPins[numRows] = {11,10,9,8}; //Keypad 8 pins
byte colPins[numCols]= {7,6,5,4}; 

Keypad myKeypad= Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);

void setup() {
 digitalWrite(Relay, HIGH);
 pinMode(Relay, OUTPUT);
 pinMode(Laser, OUTPUT);
 digitalWrite(Laser, LOW);
 delay(2000);
}

void loop() {

short Detect = analogRead(Rec);                 


   if(Detect < 500)
       detection = true;

   if(detection==true) 
       {                                       
        digitalWrite(Relay, LOW);
        char keypressed = myKeypad.getKey();
        if (keypressed == '*')                   
        Getpass();
         }
   
    if(a==4){                                   
        digitalWrite(Relay, HIGH);
        a=0;                                 
        detection=false;
        }

 
}

void Getpass(){               
 for(short i=0 ; i<4 ; i++)
           {
             
          char keypressed = myKeypad.waitForKey();
             if (keypressed==code[i])   
             a++;
           }
}

mrogers80:
I'm having an issue

And you expect us to guess what that issue is? You don't want to tell us what the problem is?

Please read the "How to use this forum" post at the top of any of the boards and please use code tags when posting code. Yes, the rules apply to you too.

It works perfectly as is with one laser sensor on A0. Being ignorant on code, I’ve copied and pasted from other projects and completed some minor editing myself. Everything I’ve tried thus far to change the Rec 0 to another input, let alone add additional inputs has failed.

mrogers80:
It works perfectly as is with one laser sensor on A0. Being ignorant on code, I’ve copied and pasted from other projects and completed some minor editing myself. Everything I’ve tried thus far to change the Rec 0 to another input, let alone add additional inputs has failed.

OK. Well I'd love to help you figure out what you did wrong but I can't see the failing code. Would it surprise you to learn that I can't debug what I can't see?

If you're looking for someone to just write it for you there is a section called "Gigs and Collaborations" where you can offer to pay folks to write code for you.

I appreciate the head's up. I'll come back once I learn more about code so that I can ask the right questions.

mrogers80:
I appreciate the head's up. I'll come back once I learn more about code so that I can ask the right questions.

If that's how you want to take it then.

I was more going for the show us what you tried and describe how it didn't meet your expectations and we will help you fix it. You obviously have some code that didn't work. Just post it and we can help you.

Or go wait until you learn it yourself. I don't care.

mrogers80:

#define Rec 0

//So did you “#define Rec2 1”

short Detect = analogRead(Rec);               
if(Detect < 500)
detection = true;
//Before moving forward, duplicate those three lines for Rec2

I'm new to all this and could use some direction.

We recommend that before taking on a significant project like this, work your way through some of the introductory tutorials that come with Arduino.

Learn to blink an LED without using delay(), read a voltage, a sensor or a switch, in order to learn the language and the special features of the Arduino.

Expect endless frustration if you skip that step.

Thanks for the help Slumpert! I was all worked up over the code and finally realized i had a bad Laser receiver on input 1. I copied the analogRead code for remaining inputs and it resolved my issue.