// declare varriable here int note0 = 2; //digital pin 2 is the output for note0 (the highest note) int note1 = 3; //digital pin 3 is the output for note1 int note2 = 4; //digital pin 4 is the output for note2 int note3 = 5; //digital pin 5 is the output for note3 int note4 = 6; //digital pin 6 is the output for note4 int note5 = 7; //digital pin 7 is the output for note5 int note6 = 8; //digital pin 8 is the output for note6 int note7 = 9; //digital pin 9 is the output for note7 (the lowest note) void setup() { pinMode(note0, OUTPUT); //Setting the pin mode for the digital pins pinMode(note1, OUTPUT); pinMode(note2, OUTPUT); pinMode(note3, OUTPUT); pinMode(note4, OUTPUT); pinMode(note5, OUTPUT); pinMode(note6, OUTPUT); pinMode(note7, OUTPUT); pinMode(A0, INPUT); //Setting the pinmode of the analog pins pinMode(A1, INPUT); pinMode(A2, INPUT); pinMode(A3, INPUT); pinMode(A4, INPUT); pinMode(A5, INPUT); pinMode(A6, INPUT); pinMode(A7, INPUT); Serial.begin(9600); //begin a serial readout } void loop() { // put your main code here, to run repeatedly: Serial.println("New Photocell Values"); int photocell0 = analogRead(A0); //writes the photocell resistance of analog pin 0 to the serial monitor Serial.println(photocell0); int photocell1 = analogRead(A1); //writes the photocell resistance of analog pin 1 to the serial monitor Serial.println(photocell1); int photocell2 = analogRead(A2); //writes the photocell resistance of analog pin 2 to the serial monitor Serial.println(photocell2); int photocell3 = analogRead(A3); //writes the photocell resistance of analog pin 3 to the serial monitor Serial.println(photocell3); int photocell4 = analogRead(A4); //writes the photocell resistance of analog pin 4 to the serial monitor Serial.println(photocell4); int photocell5 = analogRead(A5); //writes the photocell resistance of analog pin 5 to the serial monitor Serial.println(photocell5); int photocell6 = analogRead(A6); //writes the photocell resistance of analog pin 5 to the serial monitor Serial.println(photocell6); int photocell7 = analogRead(A7); //writes the photocell resistance of analog pin 5 to the serial monitor Serial.println(photocell7); Serial.println("End of Values"); delay(700); if (photocell0 > 700){ // if the photocell gets enough light it will set corresponding pin to on for a short while, then set it back to off digitalWrite(note0, HIGH); delay(100); digitalWrite(note0, LOW); delay(250); } if (photocell1 > 700){ digitalWrite(note1, HIGH); delay(100); digitalWrite(note1, LOW); delay(250); } if (photocell2 > 700){ digitalWrite(note2, HIGH); delay(100); digitalWrite(note2, LOW); delay(250); } if (photocell3 > 700){ digitalWrite(note3, HIGH); delay(100); digitalWrite(note3, LOW); delay(250); } if (photocell4 > 700){ digitalWrite(note4, HIGH); delay(100); digitalWrite(note4, LOW); delay(250); } if (photocell5 > 700){ digitalWrite(note5, HIGH); delay(100); digitalWrite(note5, LOW); delay(250); } if (photocell6 > 700){ digitalWrite(note6, HIGH); delay(100); digitalWrite(note6, LOW); delay(250); } if (photocell7 > 700){ digitalWrite(note7, HIGH); delay(100); digitalWrite(note7, LOW); delay(250); } }