# Implementing virtual Serial port communication: java with node-red (The Figures are attached in subsequent postings)

**URL:** https://discourse.nodered.org/t/implementing-virtual-serial-port-communication-java-with-node-red-the-figures-are-attached-in-subsequent-postings/56278
**Category:** General
**Created:** [8 January 2022 02:59 UTC](https://discourse.nodered.org/t/implementing-virtual-serial-port-communication-java-with-node-red-the-figures-are-attached-in-subsequent-postings/56278 "2022-01-08T02:59:47Z")
**Posts on this page:** 1
**Showing post:** 18

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [9 January 2022 07:51 UTC](https://discourse.nodered.org/t/implementing-virtual-serial-port-communication-java-with-node-red-the-figures-are-attached-in-subsequent-postings/56278/18 "2022-01-09T07:51:10Z")

</div>

Looking at figure 4, you receive `2«` from COM7. As you can see, this value arrives in `msg.payload` so your function should be checking for `msg.payload === "2«"`

E.g...

```auto
if (msg.payload === "2«") {
  msg.payload = {
    opcuaCommand:"addFolder"
  }
  msg.topic = "ns=1;s=Variables";
  return msg;
}
node.warn(`Unrecognised comm '${msg.payload}'`);
return null;

```

* * *

Forgive me for saying but this is a basic fundamental of node-red - I believe you would benefit from spending a bit time learning the basics....

* * *

### 1

* * *

I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

* * *

### 2

* * *

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

![BX00Cy7yHi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd1f333a9e043b061b39917c328b0094d3e52d30.gif)

> **[Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)**

* * *

### 3

* * *

To make code more readable and importable it is important to surround your code with three backticks  
`````  
`like this`  
`````

You can edit and correct your post by clicking the pencil icon.

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

_[View the full topic](https://discourse.nodered.org/t/implementing-virtual-serial-port-communication-java-with-node-red-the-figures-are-attached-in-subsequent-postings/56278)._
