/* matrix-scan a set of LEDs pins: "rows" 12 & 13 go to a 220Ω resistor, then to 2 LEDs each (positive / long stem side); also to a 10kΩ resistor then to 2 phototransistors (collector / long stem side) also, from between the 10kΩ and the phototransistors, wire goes to A1 & A2 "columns" 14 & 15 go to 2 LEDs each (negative / short stem side) so that given one of 12|13 and one of 14|15, one LED is identified */ #include int currentLed = 0; int lastSeen = -1; #define DEBUG 0 const size_t row_count = 5; const size_t col_count = 5; const int rows[row_count] = { 5, 23, 19, 18, 26 }; const int cols[col_count] = { 17, 33, 16, 21, 22 }; const int adc[row_count] = { 2, 4, 12, 27, 14 }; const int ampEnable = 32; const int octave_shift = 4; void setup() { Serial.begin(115200); pinMode(ampEnable, OUTPUT); digitalWrite(ampEnable, LOW); dac_i2s_disable(); dac_output_enable(DAC_CHANNEL_1); for (int i=0;i