#define NUM_CHORDS 3


const char* const chords[][5] = {
    {"G4","B4","D5"},
    {"GS4","C5","DS5"},
    {"A4","CS5","E5"}
};



int oldChord = -1;

void printChord(int chord){   
    for(int i=0; i<3; i++) {
        Serial.print(chords[chord][i]);
        Serial.print(" ");
    }
    Serial.println();
}

void setup() {
    Serial.begin(9600);
    

}

void loop() {
    int valPot = analogRead(A0);
    int chord = map(valPot, 0, 1023, 0, NUM_CHORDS);
    chord = constrain(chord, 0, NUM_CHORDS-1);

    if (oldChord != chord){
        Serial.print("Accordo n° ");
        Serial.print(chord+1);
        Serial.print(": ");
        oldChord = chord;
        printChord(chord);
    }

}