//This is a sketch for the "Simon Says" project //using a shift register, LEDs, the random and //randomSeed functions. //globals int randomValue; //random value to be received from the random function int LEDValue =1; //value to correspond to the appropriate LED via the shift register uint8_t simonSays [50]; //Simon Says (original pattern) array uint8_t iSay [50]; //User Input array int iSaySpot = 0; //Current location of the user array //global buttons that correspond to the LEDs with button1 corresponding with the LED on the far right int btns[8] = {11, 10, 9, 8, 7, 6, 5, 4}; //globals for the shift register pins int serialIn = 30; int rclk = 32; int sclk = 34; int sclr = 36; boolean finalAnsState = false; //current state of if a final answer is being submitted int finalAnsB = 26; //final answer button to be pressed int count; //how long the orignal pattern should be void setup(){ //preparing the shift register pins pinMode(serialIn, OUTPUT); pinMode(rclk, OUTPUT); pinMode(sclk, OUTPUT); pinMode(sclr, OUTPUT); //preparing the buttons on the PmodBTNs for(int i=0; i<8; i++){ pinMode(btns[i], INPUT); } //preparing the final answer button pinMode(finalAnsB, INPUT); //setting the shift register pins digitalWrite(serialIn, LOW); digitalWrite(rclk, LOW); digitalWrite(sclk, LOW); digitalWrite(sclr, LOW); //clearing out the registers digitalWrite(rclk, HIGH); digitalWrite(rclk, LOW); digitalWrite(sclr, HIGH); delay(500); count = 1; }//end of setup void loop(){ //resetting the arrays to all zeros for(int i=0; i<50; i++){ simonSays[i]= 0; iSay[i]= 0; } //loop to display an LED pattern of the approripate length for(int j=0; j