 }
 
 // function to loop over pedals
-void pedalPoll(const int pollPin, bool (&states)[numPedals], int arraySize, int pedalMidiChannel) {
+void pedalPoll(bool (&states)[numPedals], int arraySize, int pedalMidiChannel) {
   for(int key=0; key<arraySize; key++){
       // run through all switches, reading their values
       // pass results to keyChange which will dispatch a MIDI event if needed
-      keyChange(digitalRead(pollPin), states[key], key, pedalMidiChannel);
+      keyChange(digitalRead(pedalPins[key]), states[key], key, pedalMidiChannel);
   }
 }
 

// constants won't change. They're used here to
// set pin numbers for first 2 octaves
const int keyPins[] = {28, 26, 24, 22, 13, 12, 11, 10, 9, 8, 7, 6, 14, 15, 16, 17, 18, 19, 20, 21, 27, 25, 23, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 52, 50, 48, 46, 44, 42, 40, 38, 36, 34, 32, 30,};
const int rankPins[] = {5, 4, }; // drive wire(s) for ranks are: {5, 4, 3, 2, 67, and 69 (pedals)}
const int pedalPin = 69;
/*
  Note for reference, the analog -> digital pin mappings for the Mega are:
  A0 = 54

 Test serial-MIDI commands from a 61-key keyboard.

 The circuit:
 * Up to five OrganDuino 2.0 PCB shields populated with diodes
 * 61-key organ manuals soldered in with buss soldered to a Drive Pin thru-hole
 * Solder jumpers on back for each manual properly set
 * 32-key AGO pedalboard soldered in to first

 created 2016 by @JDWarner
*/
