Musical Instrument Assignment

The goal of this assignment was to create a musical instrument using the Audrino Uno. The instrument is controlled by resistors and a POT switch. The user controls what note is played by completeing the circuit with a little piece of metal. When the metal touches the different resistors, different notes play. The POT switch is used to change the octave of the note between octave 2, octave 3 and octave 4. They're for it plays 21 different notes, which are all the natural notes from C2 to B4. The frequences range from 65.405HZ to 493.88HZ. Each note will last for how long the piece of metal is touching a key, and it will stop if the metal isn't ouching any keys. The following is the code for the instrument:

/*Musical Instrument
* Andrea Thompson
* 2017/05/24 - 2017/05/31
*/

//variables for each note
int C = 130.81;
int D = 146.83;
int E = 164.81;
int F = 174.61;
int G = 196.00;
int A = 220.00;
int B = 246.94;

//variables for each key
int cKey = 4;
int dKey = 5;
int eKey = 6;
int fKey = 7;
int gKey = 8;
int aKey = 9;
int bKey = 10;
//variables for POT
int potPin = 0; //pot is in A0
int potValue; //holds the value of pot

//variables for speaker
int speakerPin = 13;
int T = 30; //time variable


void setup() {
// put your setup code here, to run once:
pinMode(cKey, INPUT);
pinMode(dKey, INPUT);
pinMode(eKey, INPUT);
pinMode(fKey, INPUT);
pinMode(gKey, INPUT);
pinMode(aKey, INPUT);
pinMode(bKey, INPUT);

pinMode(speakerPin, OUTPUT);
}

void loop() {
potValue = analogRead(potPin);

if(potValue <= 341) { //if the POT switch is in position, the notes will be in octave 2
C = 65.405;
D = 73.415;
E = 82.405;
F = 87.305;
G = 98.00;
A = 110.00;
B = 123.47;
}
else if((potValue >= 341) && (potValue <= 682)) { //if the POT switch is in position, the notes will be in octave 3
C = 130.81;
D = 146.83;
E = 164.81;
F = 174.61;
G = 196.00;
A = 220.00;
B = 246.94;
}
else{ //if the POT switch is in position, the notes will be in octave 4
C = 261.62;
D = 293.66;
E = 329.62;
F = 349.22;
G = 392.00;
A = 440.00;
B = 493.88;
}

if(digitalRead(cKey) == HIGH) {
tone(speakerPin, C, T);
}
if(digitalRead(dKey) == HIGH) {
tone(speakerPin, D, T);
}
if(digitalRead(eKey) == HIGH) {
tone(speakerPin, E, T);
}
if(digitalRead(fKey) == HIGH) {
tone(speakerPin, F, T);
}
if(digitalRead(gKey) == HIGH) {
tone(speakerPin, G, T);
}
if(digitalRead(aKey) == HIGH) {
tone(speakerPin, A, T);
}
if(digitalRead(bKey) == HIGH) {
tone(speakerPin, B, T);
}

delay(T);


}