 
   //Test the connection
   nano.getVersion();
-  if (nano.msg[0] != ALL_GOOD) return (false); //Something is not right
+  Serial.print("connection test response: ");
+  Serial.println(nano.msg[0], HEX);
+  //if (nano.msg[0] != ALL_GOOD) return (false); //Something is not right
 
   //The M6E has these settings no matter what
   nano.setTagProtocol(); //Set protocol to GEN2
-
   nano.setAntennaPort(); //Set TX/RX antenna ports to 1
 
   return (true); //We are ready to rock

  Serial.println(F("]"));
}

//Gracefully handles a reader that is already configured and already reading continuously
//Because Stream does not have a .begin() we have to do this outside the library
boolean setupNano(long baudRate)


  Single shot read - Ask the reader to tell us what tags it currently sees. And it beeps!

*/

#include <SoftwareSerial.h> // communication between ESP and RFID reader

#include "SparkFun_UHF_RFID_Reader.h" //Library for controlling the M6E Nano module

#include "util.h"


// jumper wires from:
//   GPIO 13 to shield 2
//   GPIO 15 to shield 3
// select "SW-UART" on both RFID board
// move UART switch to "HW" on the ESP board

// Create instances of the serial driver and the RFID driver
SoftwareSerial softSerial(13, 15); //RX, TX (from ESP's view)
RFID nano;


// connect these pins between the ESP and RFID reader:
//   GPIO 12 to shield 9
//   GPIO 14 to shield 10
#define BUZZER1 12
#define BUZZER2 14



void setup()
{
  board_init();  // for the functions in util.h

  Serial.begin(115200);  // Serial monitor must match this rate

  // Setup the pins for the buzzer
  pinMode(BUZZER1, OUTPUT);
  pinMode(BUZZER2, OUTPUT);
  digitalWrite(BUZZER2, LOW); //Pull half the buzzer to ground and drive the other half.

  while (!Serial);
  status(GOOD);  // blink that we are here


  // now get the RFID reader setup
  Serial.println();
  Serial.println("Initializing RFID reader...");

  // nano defaults to 115200 baud rate, keep it the same!
  
  if (setupNano(115200) == false)
  {
    Serial.println("Module failed to respond. Please check wiring.");
    while (1); //Freeze!
  }

  nano.setRegion(REGION_NORTHAMERICA); //Set to North America
  nano.setReadPower(500); //5.00 dBm. Higher values may cause USB port to brown out
  //Max Read TX Power is 27.00 dBm and may cause temperature-limit throttling

  // Uncomment this to see the commands and responses sent/received
  //   between the ESP and Reader
  //nano.enableDebugging(Serial);
}

void loop()
