 // <  200 = HOLE  = 1
 // >= 200 = PAPER = 0
 
-#define CFG_SENSOR_THRESHOLD 200
+#define CFG_SENSOR_THRESHOLD 512
+
+//Turn on to send a raw ADC value report every time it changes
+//#define CFGEN_SEND_ADC_REPORTS
 
 //Turn this on to turn a state change report every state change
 //#define CFGEN_SEND_STATE_REPORTS
 
 //Turn this on to send row data reports every detected row
-#define CFGEN_SEND_ROW_REPORTS
-
+//#define CFGEN_SEND_ROW_REPORTS
+
+// Pinouts for Sparkfun ProMicro:
+// https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/hardware-overview-pro-micro
 
 #define NUM_CHANNELS 9
-#define REG          A0
-#define D7           A1
-#define D6           A2
-#define D5           A3
-#define D4           A6
-#define D3           A7
-#define D2           A8
-#define D1           A9
-#define D0           A10
+#define REG          A0  // A0
+#define D7           A1  // A1
+#define D6           A2  // A2
+#define D5           A3  // A3
+#define D4           A6  // 4
+#define D3           A7  // 6
+#define D2           A8  // 8
+#define D1           A9  // 9
+#define D0           A10 // 10
 
 #define LED_REG      1 // TX
 #define LED_D7       0 // RX

#define REPORT_OK_CARD       0x01
#define REPORT_OK_STATE      0x02
#define REPORT_OK_ROW        0x03
#define REPORT_ERR_LENGTH    0x81

typedef enum 

  // Generate filtered versions of registration and data
  byte freg = getData(adc[8], 0);  
  byte now  = getData(adc[7], 7) | getData(adc[6], 6) | getData(adc[5], 5) | getData(adc[4], 4)
            | getData(adc[3], 3) | getData(adc[2], 2) | getData(adc[1], 1) | getData(adc[0], 0);

  // Show live diagnostics on LEDs
  writeLEDs(freg, now);

#if defined(CFGEN_SEND_ADC_REPORTS)
  if (now != sticky)
  {
    Serial.write(':');
    Serial.write(REPORT_OK_ADC);
    for (int i=8; i>=0; i--)
    {
      //in decimal ADC values are 10 bits (3 nybbles)
      Serial.print(adc[i]);
      Serial.print(" ");
    }
    Serial.println();
  }
#endif

  
  // crank round the acquisition state machine
  switch (state)
  {
