I am trying to read the 'select' pins at connector "C1" (N2~N7) in the attached schematic. These are directly connected to the A0~A5 analog in pins on the UNO (the "C2" data lines are connected D2-D9) The physical keyboard is not connected.
Noticed some suggestions on here to use direct port manipulation for speed so i have tried to refactor from DigitalRead. Now, I have the following code:
void loop() {
readSelect = int(PINC);
Serial.println(readSelect);
switch(readSelect) {
case 1 :
updatePins(0);
break;
case 2:
updatePins(1);
break;
case 4:
updatePins(2);
break;
case 10:
updatePins(3);
break;
case 20:
updatePins(4);
break;
case 40:
updatePins(5);
break;
default:
readError();
}
}
Expecting one pin to be active at a time. updatePins() never gets called. Sample output from the serial monitor:
29 61 29 61 29 61 29 61 29 61 29 61 29 61 29 61 29 61 29 61 29 61 29 ... 31 29 31 29 31 29 31 29 31 29 31 29 31 29 31 29 31 29 31 29 31 29 31 29 31 29 31 29
Previously, using the DigitalRead function it seemed all the pins were reading HIGH all of the time. The "C2" connector pins are supposed to be 'on' when receiving 9 volts. I have measured ~7V to ground from the connector "C1" pins, direct connections between "C1" and "C2" work as expected, a note is played.
I would like some advice on how to connect and read these pins if possible, thanks in advance.
sketch.ino (4.41 KB)
