serial-write

thomasbrits/my-nodes/serial-write

No description
serial-write
@/serial-write
INstring
serial-write
IN
To use the node in your project you should have the thomasbrits/my-nodes library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD evaluate_on_pin disable
#pragma XOD evaluate_on_pin enable input_IN
#pragma XOD error_catch enable

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
  if (!isInputDirty<input_IN>(ctx))
      return;

  auto err = getError<input_IN>(ctx);
  auto line = getValue<input_IN>(ctx);

  TimeMs tNow = transactionTime();
 // XOD_DEBUG_SERIAL.print(F("+XOD:"));
 // XOD_DEBUG_SERIAL.print(tNow);
 // XOD_DEBUG_SERIAL.print(':');
 // XOD_DEBUG_SERIAL.print(getNodeId(ctx));
 // XOD_DEBUG_SERIAL.print(':');
  if (err) {
    XOD_DEBUG_SERIAL.print(F("ERR"));
  } else {
    for (auto it = line.iterate(); it; ++it)
      XOD_DEBUG_SERIAL.print((char)*it);
  }

  XOD_DEBUG_SERIAL.print('\r');
  XOD_DEBUG_SERIAL.print('\n');
  XOD_DEBUG_SERIAL.flush();
}