I wrote this code and needed help debugging.

const int p1rock = 13; const int p1paper = 12; const int p1scissors = 11; const int p2rock = 10; const int p2paper = 9; const int p2scissors = 8; const int p1rockbutton = 7; const int p1paperbutton = 6; const int p1scissorsbutton = 5; const int p2rockbutton = 4; const int p2paperbutton = 3; const int p2scissorsbutton = 2; const int p2win = 24; const int p1win = 25;

int p1rockbuttonState = 0; int p1paperbuttonState = 0; int p1scissorsbuttonState = 0; int p2rockbuttonState = 0; int p2paperbuttonState = 0; int p2scissorsbuttonState = 0;

void setup() { pinMode(p1rock, OUTPUT); pinMode(p1paper, OUTPUT); pinMode(p1scissors, OUTPUT); pinMode(p2rock, OUTPUT); pinMode(p2paper, OUTPUT); pinMode(p2scissors, OUTPUT); pinMode(p1win, OUTPUT); pinMode(p2win, OUTPUT); pinMode(p1rockbutton , INPUT); pinMode(p1paperbutton , INPUT); pinMode(p1scissorsbutton , INPUT); pinMode(p2rockbutton , INPUT); pinMode(p2paperbutton , INPUT); pinMode(p2scissorsbutton , INPUT); }

void loop() { p1rockbuttonState = digitalRead(p1rockbutton); p1paperbuttonState = digitalRead(p1paperbutton); p1scissorsbuttonState = digitalRead(p1scissorsbutton); p2rockbuttonState = digitalRead(p2rockbutton); p2paperbuttonState = digitalRead(p2paperbutton); p2scissorsbuttonState = digitalRead(p2scissorsbutton); if(p1rockbuttonState == HIGH) { digitalWrite(p1rock, HIGH); delay(1000); } else { digitalWrite(p1rock, LOW); } if(p1paperbuttonState == HIGH) { digitalWrite(p1paper, HIGH); delay(1000); } else { digitalWrite(p1paper, LOW); } if(p1scissorsbuttonState == HIGH) { digitalWrite(p1scissors, HIGH); delay(1000); } else { digitalWrite(p1scissors, LOW); } if(p2rockbuttonState == HIGH) { digitalWrite(p2rock, HIGH); delay(1000); } else { digitalWrite(p2rock, LOW); } if(p2paperbuttonState == HIGH) { digitalWrite(p2paper, HIGH); delay(1000); } else { digitalWrite(p2paper, LOW); } if(p2scissorsbuttonState == HIGH) { digitalWrite(p2scissors, HIGH); delay(1000); } else { digitalWrite(p2scissors, LOW); } if(p1rock == HIGH && p2rock == HIGH) { digitalWrite(p1win, HIGH); digitalWrite(p2win, HIGH); delay(1000); } else if(p1paper == HIGH && p2paper == HIGH) { digitalWrite(p1win, HIGH); digitalWrite(p2win, HIGH); delay(1000); } else if(p1scissors == HIGH && p2scissors == HIGH) { digitalWrite(p1win, HIGH); digitalWrite(p2win, HIGH); delay(1000); } else if(p1rock == HIGH && p2scissors == HIGH) { digitalWrite(p1win, HIGH); digitalWrite(p2win, LOW); delay(1000); } else if(p1paper == HIGH && p2rock == HIGH) { digitalWrite(p1win, HIGH); digitalWrite(p2win, LOW); delay(1000); } else if(p1scissors == HIGH && p2paper == HIGH) { digitalWrite(p1win, HIGH); digitalWrite(p2win, LOW); delay(1000); } else if(p2rock == HIGH && p1scissors == HIGH) { digitalWrite(p2win, HIGH); digitalWrite(p1win, LOW); delay(1000); } else if(p2paper == HIGH && p1rock == HIGH) { digitalWrite(p2win, HIGH); digitalWrite(p1win, LOW); delay(1000); } else if(p2scissors == HIGH && p1paper == HIGH) { digitalWrite(p2win, HIGH); digitalWrite(p1win, LOW); delay(1000); } else { digitalWrite(p2win, LOW); digitalWrite(p1win, LOW); } if (p1win > 0 || p2win > 0) { digitalWrite(p1rock, LOW); digitalWrite(p1paper, LOW); digitalWrite(p1scissors, LOW); digitalWrite(p2rock, LOW); digitalWrite(p2paper, LOW); digitalWrite(p2scissors, LOW); digitalWrite(p1win, LOW); digitalWrite(p2win, LOW); } }

I want to play rock paper scissors and then led lights up when you choose then it tells you the winner and shuts leds off

in a bid to not have to sift through ALL your code, what errors are you getting? 8)

Each of those delay(1000) will stop you reading the input from the players for a second. See the blink without delay example"

Always auto format code before posting and use code tags not quotes.

Mark

sst00, the IDE copy for forum "feature" is no good. Maybe long ago it was but not in years has it worked right.

Code needs to be put in "code tags". They're like quote tags but they say code instead of quote. In the forum edit window, the # button (above the smileys) makes a set of code tags. They work right.

You need to learn about arrays and loops. You should understand why once you do and look at your code again. http://arduino.cc/en/Tutorial/Array

Your IDE has this example. Load it using the File menu. File->Examples->05.Control->Arrays You might not have to wire it and run it to figure it out, it's pretty simple.