{
  "patches": {
    "@/main": {
      "links": {
        "BkTQRjwCd": {
          "id": "BkTQRjwCd",
          "output": {
            "nodeId": "rJOXhiDCd",
            "pinKey": "Sk450OL-X"
          },
          "input": {
            "nodeId": "HyHQCoP0d",
            "pinKey": "SJaxW1ubX"
          }
        },
        "B1IcknwC_": {
          "id": "B1IcknwC_",
          "output": {
            "nodeId": "rJOXhiDCd",
            "pinKey": "Sk450OL-X"
          },
          "input": {
            "nodeId": "Bkbq1nwCO",
            "pinKey": "HkT8KhLWm"
          }
        },
        "rknAvR_0O": {
          "id": "rknAvR_0O",
          "output": {
            "nodeId": "HyHQCoP0d",
            "pinKey": "B1McTiwC_"
          },
          "input": {
            "nodeId": "Bkbq1nwCO",
            "pinKey": "ryGwYhIZm"
          }
        },
        "SkF4lxF0O": {
          "id": "SkF4lxF0O",
          "output": {
            "nodeId": "r1VZexYAd",
            "pinKey": "Skzk0Fm1mH"
          },
          "input": {
            "nodeId": "HkuVxxKCO",
            "pinKey": "BkEedrl7B"
          }
        },
        "SJ_rxgFRd": {
          "id": "SJ_rxgFRd",
          "output": {
            "nodeId": "HyHQCoP0d",
            "pinKey": "B1McTiwC_"
          },
          "input": {
            "nodeId": "HkuVxxKCO",
            "pinKey": "SkWokdHx7r"
          }
        },
        "Hkgz_gtCd": {
          "id": "Hkgz_gtCd",
          "output": {
            "nodeId": "rJOXhiDCd",
            "pinKey": "Sk0ktvLO7"
          },
          "input": {
            "nodeId": "Sksb_etCd",
            "pinKey": "Syg6VW9xQS"
          }
        },
        "rJv7ueKA_": {
          "id": "rJv7ueKA_",
          "output": {
            "nodeId": "rJU7dxFAd",
            "pinKey": "ryVmUAOrvkb"
          },
          "input": {
            "nodeId": "Sksb_etCd",
            "pinKey": "rkM6N-cxmB"
          }
        },
        "BkAQulYA_": {
          "id": "BkAQulYA_",
          "output": {
            "nodeId": "rJU7dxFAd",
            "pinKey": "ryVmUAOrvkb"
          },
          "input": {
            "nodeId": "rJOXhiDCd",
            "pinKey": "HklRJFDLOX"
          }
        },
        "By8nYltRd": {
          "id": "By8nYltRd",
          "output": {
            "nodeId": "HyHQCoP0d",
            "pinKey": "B1McTiwC_"
          },
          "input": {
            "nodeId": "B1ShFeKA_",
            "pinKey": "BkjI-COLb"
          }
        },
        "HJvnKetRO": {
          "id": "HJvnKetRO",
          "output": {
            "nodeId": "B1ShFeKA_",
            "pinKey": "ByAIWR_UZ"
          },
          "input": {
            "nodeId": "HkuVxxKCO",
            "pinKey": "Syljy_rgmr"
          }
        },
        "SkmzEXFCd": {
          "id": "SkmzEXFCd",
          "output": {
            "nodeId": "HyHQCoP0d",
            "pinKey": "B1HYu0_AO"
          },
          "input": {
            "nodeId": "Bkbq1nwCO",
            "pinKey": "H1VpIKnLb7"
          }
        }
      },
      "nodes": {
        "rJOXhiDCd": {
          "boundLiterals": {
            "BytfJKIWX": "9600"
          },
          "id": "rJOXhiDCd",
          "type": "xod/uart/uart-0",
          "position": {
            "x": 1,
            "y": -6,
            "units": "slots"
          }
        },
        "HyHQCoP0d": {
          "boundLiterals": {
            "rkc7Wyu-m": "Continuously"
          },
          "id": "HyHQCoP0d",
          "type": "@/read-bytes-to-string-with-stop",
          "position": {
            "x": 2,
            "y": -5,
            "units": "slots"
          }
        },
        "Bkbq1nwCO": {
          "boundLiterals": {
            "ryGwYhIZm": "\"Hellow\"",
            "H1VpIKnLb7": "Continuously"
          },
          "id": "Bkbq1nwCO",
          "type": "xod/uart/print",
          "position": {
            "x": 1,
            "y": -3,
            "units": "slots"
          }
        },
        "r1VZexYAd": {
          "id": "r1VZexYAd",
          "type": "xod-dev/text-lcd/text-lcd-parallel-device",
          "position": {
            "x": 7,
            "y": -5,
            "units": "slots"
          }
        },
        "HkuVxxKCO": {
          "boundLiterals": {
            "ByQiydrlQr": "0",
            "rk4iydre7r": "0",
            "Syljy_rgmr": "Continuously",
            "ryBi1_rl7r": "16"
          },
          "id": "HkuVxxKCO",
          "type": "xod-dev/text-lcd/print-at(text-lcd-parallel-device)",
          "position": {
            "x": 7,
            "y": -3,
            "units": "slots"
          }
        },
        "Sksb_etCd": {
          "id": "Sksb_etCd",
          "type": "xod/core/wait-all-once",
          "position": {
            "x": 6,
            "y": -6,
            "units": "slots"
          }
        },
        "rJU7dxFAd": {
          "id": "rJU7dxFAd",
          "type": "xod/core/boot",
          "position": {
            "x": 5,
            "y": -7,
            "units": "slots"
          }
        },
        "B1ShFeKA_": {
          "id": "B1ShFeKA_",
          "type": "xod/core/pulse-on-change",
          "position": {
            "x": 5,
            "y": -4,
            "units": "slots"
          }
        }
      },
      "comments": {
        "H1aks-YAO": {
          "id": "H1aks-YAO",
          "position": {
            "x": 13,
            "y": -4,
            "units": "slots"
          },
          "size": {
            "width": 6,
            "height": 2,
            "units": "slots"
          },
          "content": "lcd connected to String out to see if any partial strings are coming out, but couldn't connect to stop byte. Overall, the lcd was used to troubleshoot the Serial talk-back."
        }
      },
      "path": "@/main"
    },
    "@/test": {
      "attachments": [
        {
          "filename": "patch.cpp",
          "encoding": "utf-8",
          "content": "#pragma XOD evaluate_on_pin disable\n#pragma XOD evaluate_on_pin enable input_READ\n#pragma XOD error_raise enable\n\nnode {\n    void evaluate(Context ctx) {\n        if (!isInputDirty<input_READ>(ctx))\n            return;\n\n        auto uart = getValue<input_UART>(ctx);\n        if (!uart->available()) {\n            raiseError(ctx);\n            return;\n        }\n\n        uint8_t byte = 0x00;\n        if (uart->readByte(&byte)) {\n            emitValue<output_DONE>(ctx, 1);\n            emitValue<output_BYTE>(ctx, byte);\n        } else {\n            raiseError(ctx); // Can't read byte\n        }\n    }\n}\n"
        }
      ],
      "nodes": {
        "r185T6OCO": {
          "description": "An UART object",
          "label": "UART",
          "id": "r185T6OCO",
          "position": {
            "x": 3,
            "y": -0.8492062523251489,
            "units": "slots"
          },
          "type": "xod/uart/input-uart"
        },
        "BkgLcpT_CO": {
          "description": "Pulses when there is nothing to read from UART",
          "label": "N",
          "id": "BkgLcpT_CO",
          "position": {
            "x": 5,
            "y": 1.150793747674851,
            "units": "slots"
          },
          "type": "xod/patch-nodes/output-pulse"
        },
        "BJZUqTauA_": {
          "id": "BJZUqTauA_",
          "position": {
            "x": 3,
            "y": 0.1507937476748511,
            "units": "slots"
          },
          "type": "xod/patch-nodes/not-implemented-in-xod"
        },
        "SJfI9pauRd": {
          "description": "Pulses when UART have available bytes",
          "label": "Y",
          "id": "SJfI9pauRd",
          "position": {
            "x": 3,
            "y": 1.150793747674851,
            "units": "slots"
          },
          "type": "xod/patch-nodes/output-pulse"
        },
        "BJ78cppORO": {
          "description": "Check does UART have an available bytes to read",
          "label": "UPD",
          "id": "BJ78cppORO",
          "position": {
            "x": 5,
            "y": -0.8492062523251489,
            "units": "slots"
          },
          "type": "xod/patch-nodes/input-pulse"
        }
      },
      "path": "@/test"
    },
    "@/readfromwrite": {
      "attachments": [
        {
          "filename": "patch.cpp",
          "encoding": "utf-8",
          "content": "#pragma XOD evaluate_on_pin disable\n#pragma XOD evaluate_on_pin enable input_SEND\n#pragma XOD error_raise enable\n\nnode {\n    void evaluate(Context ctx) {\n        if (!isInputDirty<input_SEND>(ctx))\n            return;\n\n        auto uart = getValue<input_UART>(ctx);\n        auto data = getValue<input_DATA>(ctx);\n\n        for (auto it = data.iterate(); it; ++it) {\n            bool err = !(uart->writeByte((char)*it));\n            if (err)\n                return raiseError(ctx);\n        }\n        if (!uart->writeByte('\\r'))\n            return raiseError(ctx);\n        if (!uart->writeByte('\\n'))\n            return raiseError(ctx);\n        uart->flush();\n        emitValue<output_DONE>(ctx, 1);\n    }\n}\n"
        }
      ],
      "nodes": {
        "SJMKU6uCd": {
          "id": "SJMKU6uCd",
          "position": {
            "x": 0,
            "y": 0.75,
            "units": "slots"
          },
          "type": "xod/patch-nodes/not-implemented-in-xod"
        },
        "rkgGF8adA_": {
          "boundLiterals": {
            "__out__": "On Boot"
          },
          "description": "Triggers write of a string into UART",
          "label": "SEND",
          "id": "rkgGF8adA_",
          "position": {
            "x": 2.05,
            "y": -0.25,
            "units": "slots"
          },
          "type": "xod/patch-nodes/input-pulse"
        },
        "r1bzFU6OCO": {
          "description": "Pulses when all String has been written",
          "label": "DONE",
          "id": "r1bzFU6OCO",
          "position": {
            "x": 0,
            "y": 1.75,
            "units": "slots"
          },
          "type": "xod/patch-nodes/output-pulse"
        },
        "BkMzF8pdC_": {
          "description": "String to be sent into UART.\nCould contain \"\\r\\n\" symbols to sent few lines.",
          "label": "DATA",
          "id": "BkMzF8pdC_",
          "position": {
            "x": 1.05,
            "y": -0.25,
            "units": "slots"
          },
          "type": "xod/patch-nodes/input-string"
        },
        "H1oFUa_RO": {
          "description": "An UART object",
          "label": "UART",
          "id": "H1oFUa_RO",
          "position": {
            "x": 0,
            "y": -0.25,
            "units": "slots"
          },
          "type": "xod/uart/input-uart"
        }
      },
      "path": "@/readfromwrite"
    },
    "@/read-bytes-to-string-with-stop": {
      "description": "Reads all available bytes from UART one by one.\n\nPossible errors:\n— Can't read byte",
      "links": {
        "B1ronQZxB": {
          "id": "B1ronQZxB",
          "input": {
            "nodeId": "HyXpjQZxS",
            "pinKey": "By_OfMFW7"
          },
          "output": {
            "nodeId": "SJaxW1ubX",
            "pinKey": "__out__"
          }
        },
        "HkzWZJO-Q": {
          "id": "HkzWZJO-Q",
          "input": {
            "nodeId": "HJKlW1dZm",
            "pinKey": "HkeKDhI-7"
          },
          "output": {
            "nodeId": "SJaxW1ubX",
            "pinKey": "__out__"
          }
        },
        "SkxGNzFZX": {
          "id": "SkxGNzFZX",
          "input": {
            "nodeId": "HkYbVft-X",
            "pinKey": "ByU7LRuSPkW"
          },
          "output": {
            "nodeId": "rJQWNzYb7",
            "pinKey": "HJhXDIY9-"
          }
        },
        "r1FqhXWgS": {
          "id": "r1FqhXWgS",
          "input": {
            "nodeId": "HkYbVft-X",
            "pinKey": "ryv7IRdSP1b"
          },
          "output": {
            "nodeId": "rkc7Wyu-m",
            "pinKey": "__out__"
          }
        },
        "r1Hq2Q-lH": {
          "id": "r1Hq2Q-lH",
          "input": {
            "nodeId": "HJKlW1dZm",
            "pinKey": "r1bXu3LWm"
          },
          "output": {
            "nodeId": "HyXpjQZxS",
            "pinKey": "S1dYzzYWm"
          }
        },
        "rknV6KXzQ": {
          "id": "rknV6KXzQ",
          "input": {
            "nodeId": "rJQWNzYb7",
            "pinKey": "BJI7P8t9Z"
          },
          "output": {
            "nodeId": "HJKlW1dZm",
            "pinKey": "Hkeetvn8-Q"
          }
        },
        "ryD9n7WlS": {
          "id": "ryD9n7WlS",
          "input": {
            "nodeId": "HyXpjQZxS",
            "pinKey": "rkytzGK-7"
          },
          "output": {
            "nodeId": "HkYbVft-X",
            "pinKey": "ByHmL0uHPk-"
          }
        },
        "SJYPvRdCO": {
          "id": "SJYPvRdCO",
          "output": {
            "nodeId": "r1oyToP0u",
            "pinKey": "S1s7pCDbQ"
          },
          "input": {
            "nodeId": "B1McTiwC_",
            "pinKey": "__in__"
          }
        },
        "r18Ku0u0O": {
          "id": "r18Ku0u0O",
          "output": {
            "nodeId": "Bk7_O0uAO",
            "pinKey": "__out__"
          },
          "input": {
            "nodeId": "B1HYu0_AO",
            "pinKey": "__in__"
          }
        },
        "rJH_FRO0_": {
          "id": "rJH_FRO0_",
          "output": {
            "nodeId": "HJKlW1dZm",
            "pinKey": "Skw_dnU-Q"
          },
          "input": {
            "nodeId": "r1oyToP0u",
            "pinKey": "HJi_30PZX"
          }
        },
        "HJOXjAdR_": {
          "id": "HJOXjAdR_",
          "output": {
            "nodeId": "HJKlW1dZm",
            "pinKey": "Hkeetvn8-Q"
          },
          "input": {
            "nodeId": "r1oyToP0u",
            "pinKey": "r1NYhRDZ7"
          }
        },
        "rk-C8gKC_": {
          "id": "rk-C8gKC_",
          "output": {
            "nodeId": "rkE-GlYR_",
            "pinKey": "ryVmUAOrvkb"
          },
          "input": {
            "nodeId": "rJ66LgFCO",
            "pinKey": "ByU7LRuSPkW"
          }
        },
        "HyNAIeYRu": {
          "id": "HyNAIeYRu",
          "output": {
            "nodeId": "HyXpjQZxS",
            "pinKey": "HJnKfztbm"
          },
          "input": {
            "nodeId": "rJ66LgFCO",
            "pinKey": "ryv7IRdSP1b"
          }
        },
        "rkw0UxtRd": {
          "id": "rkw0UxtRd",
          "output": {
            "nodeId": "rJ66LgFCO",
            "pinKey": "ByHmL0uHPk-"
          },
          "input": {
            "nodeId": "r1oyToP0u",
            "pinKey": "HyvKhAv-7"
          }
        },
        "ryOupxtRO": {
          "id": "ryOupxtRO",
          "output": {
            "nodeId": "HJKlW1dZm",
            "pinKey": "Skw_dnU-Q"
          },
          "input": {
            "nodeId": "H1X_plFRd",
            "pinKey": "rJXICuSwyW"
          }
        },
        "Sy_MAltAu": {
          "id": "Sy_MAltAu",
          "output": {
            "nodeId": "H1X_plFRd",
            "pinKey": "H1E8AuSPkZ"
          },
          "input": {
            "nodeId": "Bk7_O0uAO",
            "pinKey": "__in__"
          }
        },
        "SybXJ-Y0_": {
          "id": "SybXJ-Y0_",
          "output": {
            "nodeId": "Hy-ly-FAu",
            "pinKey": "__out__"
          },
          "input": {
            "nodeId": "H1X_plFRd",
            "pinKey": "HJG8C_SPkb"
          }
        },
        "S19XP7tRu": {
          "id": "S19XP7tRu",
          "output": {
            "nodeId": "rJuXPQKA_",
            "pinKey": "__out__"
          },
          "input": {
            "nodeId": "r1oyToP0u",
            "pinKey": "HkAv2Av-X"
          }
        }
      },
      "nodes": {
        "HJKlW1dZm": {
          "id": "HJKlW1dZm",
          "position": {
            "x": 3,
            "y": 3,
            "units": "slots"
          },
          "type": "xod/uart/read-byte"
        },
        "HkYbVft-X": {
          "id": "HkYbVft-X",
          "position": {
            "x": 6,
            "y": 1,
            "units": "slots"
          },
          "type": "xod/core/any"
        },
        "HyXpjQZxS": {
          "id": "HyXpjQZxS",
          "position": {
            "x": 5,
            "y": 2,
            "units": "slots"
          },
          "type": "xod/uart/is-available"
        },
        "SJaxW1ubX": {
          "description": "An UART object",
          "label": "UART",
          "id": "SJaxW1ubX",
          "position": {
            "x": 3,
            "y": 0,
            "units": "slots"
          },
          "type": "xod/uart/input-uart"
        },
        "rJQWNzYb7": {
          "id": "rJQWNzYb7",
          "position": {
            "x": 9,
            "y": 2,
            "units": "slots"
          },
          "type": "xod/core/defer"
        },
        "rkc7Wyu-m": {
          "description": "Trigger reading bytes from UART",
          "label": "READ",
          "id": "rkc7Wyu-m",
          "position": {
            "x": 6,
            "y": 0,
            "units": "slots"
          },
          "type": "xod/patch-nodes/input-pulse"
        },
        "r1oyToP0u": {
          "boundLiterals": {
            "HkAv2Av-X": "30"
          },
          "id": "r1oyToP0u",
          "type": "xod/stream/accumulate-string",
          "position": {
            "x": 2,
            "y": 5,
            "units": "slots"
          }
        },
        "B1McTiwC_": {
          "label": "string out",
          "id": "B1McTiwC_",
          "type": "xod/patch-nodes/output-string",
          "position": {
            "x": 2,
            "y": 6,
            "units": "slots"
          }
        },
        "Bk7_O0uAO": {
          "id": "Bk7_O0uAO",
          "type": "xod/core/pulse-on-true",
          "position": {
            "x": 7,
            "y": 5,
            "units": "slots"
          }
        },
        "B1HYu0_AO": {
          "label": "stop byte found",
          "id": "B1HYu0_AO",
          "type": "xod/patch-nodes/output-pulse",
          "position": {
            "x": 7,
            "y": 6,
            "units": "slots"
          }
        },
        "rkE-GlYR_": {
          "id": "rkE-GlYR_",
          "type": "xod/core/boot",
          "position": {
            "x": 11,
            "y": 3,
            "units": "slots"
          }
        },
        "rJ66LgFCO": {
          "id": "rJ66LgFCO",
          "type": "xod/core/any",
          "position": {
            "x": 10,
            "y": 4,
            "units": "slots"
          }
        },
        "H1X_plFRd": {
          "boundLiterals": {
            "HJG8C_SPkb": "0Dh"
          },
          "id": "H1X_plFRd",
          "type": "xod/core/equal(byte)",
          "position": {
            "x": 7,
            "y": 4,
            "units": "slots"
          }
        },
        "Hy-ly-FAu": {
          "boundLiterals": {
            "__out__": "0Dh"
          },
          "description": "Stop byte to determine the end of the message.\n0Dh = CR = '\\r'",
          "label": "stop byte",
          "id": "Hy-ly-FAu",
          "type": "xod/patch-nodes/input-byte",
          "position": {
            "x": 8,
            "y": 0,
            "units": "slots"
          }
        },
        "rJuXPQKA_": {
          "id": "rJuXPQKA_",
          "type": "xod/patch-nodes/input-number",
          "position": {
            "x": 2,
            "y": 0,
            "units": "slots"
          },
          "label": "CAP",
          "boundLiterals": {
            "__out__": "30"
          }
        }
      },
      "comments": {
        "SkMe9bKAu": {
          "id": "SkMe9bKAu",
          "position": {
            "x": 13,
            "y": 4,
            "units": "slots"
          },
          "size": {
            "width": 6,
            "height": 2,
            "units": "slots"
          },
          "content": "Resets the String from memory. Not sure how to get better control than just waiting for NO bytes available, because consecutive messages will be lost. Resetting on boot helps clear out text on the LCD for troubleshooting, like if you forgot to close the Arduino Serial Monitor."
        }
      },
      "path": "@/read-bytes-to-string-with-stop"
    }
  },
  "name": "uart-test"
}
