 #include <OpenMRN.h>
 #include <openlcb/TcpDefs.hxx>
 
+#include "openlcb/MultiConfiguredConsumer.hxx"
+
 #include "config.h"
 
+// Pick one mode below, if you select USE_WIFI it will expose this node on WIFI
+// if you select USE_CAN, this node will be available on CAN.
+
+#define USE_WIFI
+// #define USE_CAN
+
+/// This is the node id to assign to this device, this must be unique
+/// on the CAN bus.
+static constexpr uint64_t NODE_ID = UINT64_C(0x050101011423);
+
+#if defined(USE_WIFI)
 /// This is the TCP/IP port which the ESP32 will listen on for incoming
 /// GridConnect formatted CAN frames.
 constexpr uint16_t OPENMRN_TCP_PORT = 12021L;
-
-/// This is the node id to assign to this device, this must be unique
-/// on the CAN bus.
-static constexpr uint64_t NODE_ID = UINT64_C(0x050101011423);
 
 // Configuring WiFi accesspoint name and password
 // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

/// This is the TCP/IP listener on the ESP32.
WiFiServer openMRNServer(OPENMRN_TCP_PORT);

/// This is the primary entrypoint for the OpenMRN/LCC stack.
OpenMRN openmrn(NODE_ID);


/// layout. The argument of offset zero is ignored and will be removed later.
static constexpr openlcb::ConfigDef cfg(0);

// Declare output pins
// NOTE: pins 6-11 are connected to the onboard flash and can not be used for
// any purpose and pins 34-39 are INPUT only.
GPIO_PIN(IO0, GpioOutputSafeLow, 15);
GPIO_PIN(IO1, GpioOutputSafeLow, 2);
GPIO_PIN(IO2, GpioOutputSafeLow, 16);
GPIO_PIN(IO3, GpioOutputSafeLow, 17);
GPIO_PIN(IO4, GpioOutputSafeLow, 13);
GPIO_PIN(IO5, GpioOutputSafeLow, 12);
GPIO_PIN(IO6, GpioOutputSafeLow, 14);
GPIO_PIN(IO7, GpioOutputSafeLow, 27);

// List of GPIO objects that will be used for the output pins. You should keep
// the constexpr declaration, because it will produce a compile error in case
// the list of pointers cannot be compiled into a compiler constant and thus
// would be placed into RAM instead of ROM.
constexpr const Gpio *const kOutputGpio[] = {
    IO0_Pin::instance(), IO1_Pin::instance(), //
    IO2_Pin::instance(), IO3_Pin::instance(), //
    IO4_Pin::instance(), IO5_Pin::instance(), //
    IO6_Pin::instance(), IO7_Pin::instance()  //
};

openlcb::MultiConfiguredConsumer gpio_consumers(openmrn.stack()->node(), kOutputGpio,
    ARRAYSIZE(kOutputGpio), cfg.seg().consumers());

// Declare input pins, these are using analog pins as digital inputs
// NOTE: pins 25 and 26 can not safely be used as analog pins while
