Multiple PhotoSensors

I’m New to the Arduino and have been working on a project for a few days now. I think it’s probably pretty easy for the experienced folks. But I’m asking for any help. I have an Arduino Uno and using a Seeed Relay Shield. And all I’m trying to accomplish is have 4 photocells when a laser hits each one it will trigger one of the relays. I can make one photocell work at a time but cannot get more than that.
Here is a sample of my code that I have been playing around with but obviously am missing something.

Any Help would be greatly appreciated.
Thanks in advance.

int photor = 0;
int photor1 = 1;
int photorValue = 0;
int relayPin[4] = {4,5,6,7};

void setup()
{
Serial.begin(9600);
int i=0;

for(i=0; i < 4 ; i++)
{
pinMode(relayPin*, OUTPUT);*

  • }*
    }
    void loop()
    {
  • photor = analogRead(0) ;*
  • photor1 = analogRead(1);*
  • Serial.println(photor);*
  • int i=0,;*
  • if (photor> 160)*
  • {*
    _ digitalWrite(relayPin*,HIGH);_
    _
    }_
    _
    if (photor < 50)_
    _
    {_
    _ digitalWrite(relayPin,LOW);
    delay(2000);
    }*_

Looks like you've got an array for your relay pins, but not for your photoresistors. In the end, the array method is the "better" way to go, but it may be a little more understandable for you to complete adding the photoresistors as if statements; just like the first one. Then you can go back and make an array out of them an simplify your loop() function.

Personally it makes no difference to me, but some people have fits if you don't have absolute consistency with your datanames. So lets name photor photor0, and add the others as photor2 and photor3.

So down in your loop(), you would want to go ahead and add the analogRead() function calls for the other two sensors. Then you simply repeat the if statement structure that you already have, just doctoring it up to use the appropriate photor dataname.

Finally, you will want to remove the delay() function call.

This should hopefully get you started without actually doing it for you.