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);
}*_