 #define argData "code"
 #define argBits "bits"
 #define argRepeat "repeats"
-#define DEBUG True
+
+#define _MY_VERSION_ "v0.4"
+
+#if IR_LED != 1  // Disable debug output if the LED is on the TX (D1) pin.
+#undef DEBUG
+#define DEBUG true  // Change to 'false' to disable all serial output.
+#else
+#undef DEBUG
+#define DEBUG false
+#endif
+// NOTE: Make sure you set your Serial Monitor to the same speed.
+#define BAUD_RATE 115200  // Serial port Baud rate.
 
 // Globals
 ESP8266WebServer server(HTTP_PORT);

#include <string>

// Configuration parameters
#define IR_LED 4  // GPIO the IR LED is connected to/controlled by. GPIO 4 = D2.
#define HTTP_PORT 80  // The port the HTTP server is listening on.
#define HOSTNAME "ir_server"  // Name of the device you want in mDNS.


  irsend.begin();

  #ifdef DEBUG
  // Use SERIAL_TX_ONLY so that the RX pin can be freed up for GPIO/IR use.
  Serial.begin(BAUD_RATE, SERIAL_8N1, SERIAL_TX_ONLY);
  while (!Serial)  // Wait for the serial connection to be establised.
    delay(50);
  Serial.println();
  debug("IRMQTTServer " _MY_VERSION_" has booted.");
  #endif  // DEBUG

  setup_wifi();
