# How to get a \`\\\` displayed in a message

**URL:** <https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091>\
**Category:** General\
**Created:** [27 August 2020 10:39 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091 "2020-08-27T10:39:50Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 August 2020 10:39 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/1 "2020-08-27T10:39:51Z")

</div>

I am messing about and need an _animation_ to indicate things happening.

The _old_ rotating character comes to mind.

`|`  
`/`  
`-`  
`\`  
and so on.

But I can't get the \ to work.

I've tried `\\` but that didn't look right. Both `\` were orange.... So probably not right.

---

<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:** [27 August 2020 11:05 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/2 "2020-08-27T11:05:02Z")

</div>

As you have posted no details it's hard to tell what you issue is.

Have a look at the animated icons [here](https://fontawesome.com/v4.7.0/examples/)

> Use the `fa-spin` class to get any icon to rotate, and use `fa-pulse` to have it rotate with 8 steps. Works well with `fa-spinner` , `fa-refresh` , and `fa-cog` .

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [27 August 2020 11:06 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/3 "2020-08-27T11:06:57Z")

</div>

Depends on where you are using the .  
In a function you need indeed 2x \ , both becomes orange and that's normal.  
If you using the \ in for example an injection node one \ is sufficient.

You can always check with a debug node what's really in the message.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 August 2020 11:09 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/4 "2020-08-27T11:09:39Z")

</div>

```auto
x = context.get("LAST") || 0;

if (x == 0)
{
    // 0
    msg.payload = "|@0,0";
} else
if (x == 1)
{
    // 1
    msg.payload = "/@0,0"
} else
if (x == 2)
{
    // 2
    msg.payload = "-@0,0";
} else

if (x == 3)
{
    // 3
    msg.payload = "*@0,0";
}
x = (x + 1) % 4;
context.set("LAST",x);

msg.topic = "text";

return msg;

```

I have had to make the last one a `*` instead of a `\`.

This is being sent to a LCD. So I can't really use an icon. ☹  
Sorry.

So when I try with:  
`msg.payload = "\\@0,0";`

Both the `\` are orange. I also tried it and it doesn't work.

---

<div class="post-metadata">

**Author:** ![ArneR](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arner/32/95658_2.png) [@ArneR](https://discourse.nodered.org/u/ArneR)\
**Post date:** [27 August 2020 11:12 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/5 "2020-08-27T11:12:53Z")

</div>

Not sure what you want. _(Edit: your previous post provided clarification.)_

But even without programming you can get far, certainly not the best solution. But when it works ...

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/c/5c8e7aad00a6dd80fe0cd92c46c1f83daff4121d.png)

**Flow:**

```auto
[{"id":"2775c6a2.12323a","type":"ui_text","z":"90af3ff8.12c38","group":"564db5d9.e3176c","order":3,"width":0,"height":0,"name":"","label":"Text","format":"{{msg.payload}}","layout":"row-spread","x":2710,"y":3740,"wires":[]},{"id":"aafd5d3b.67cd6","type":"inject","z":"90af3ff8.12c38","name":"Start","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","payload":"open","payloadType":"str","x":2110,"y":3740,"wires":[["1948519b.54cfce","90ccd6a0.6f9bf8"]]},{"id":"1948519b.54cfce","type":"change","z":"90af3ff8.12c38","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"|","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2300,"y":3740,"wires":[["b969e7ac.46fc58","2775c6a2.12323a"]]},{"id":"b969e7ac.46fc58","type":"delay","z":"90af3ff8.12c38","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":2130,"y":3800,"wires":[["aa15545a.6a4518"]]},{"id":"aa15545a.6a4518","type":"change","z":"90af3ff8.12c38","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"/","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2300,"y":3800,"wires":[["2775c6a2.12323a","8adba2ea.3a33c"]]},{"id":"8adba2ea.3a33c","type":"delay","z":"90af3ff8.12c38","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":2130,"y":3860,"wires":[["126a7cc0.86ec03"]]},{"id":"126a7cc0.86ec03","type":"change","z":"90af3ff8.12c38","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"-","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2300,"y":3860,"wires":[["2775c6a2.12323a","425c82bd.e583fc"]]},{"id":"425c82bd.e583fc","type":"delay","z":"90af3ff8.12c38","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":2130,"y":3920,"wires":[["10a1557a.476d4b"]]},{"id":"10a1557a.476d4b","type":"change","z":"90af3ff8.12c38","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"\\","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2300,"y":3920,"wires":[["2775c6a2.12323a","f0256daf.6ff82"]]},{"id":"f0256daf.6ff82","type":"delay","z":"90af3ff8.12c38","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":2130,"y":3980,"wires":[["8c3a7b98.882508"]]},{"id":"8c3a7b98.882508","type":"change","z":"90af3ff8.12c38","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"|","tot":"str"},{"t":"delete","p":"topic","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2300,"y":3980,"wires":[["2775c6a2.12323a","90ccd6a0.6f9bf8"]]},{"id":"90ccd6a0.6f9bf8","type":"gate","z":"90af3ff8.12c38","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":2470,"y":4040,"wires":[["b969e7ac.46fc58"]]},{"id":"1df6e2e3.26c42d","type":"inject","z":"90af3ff8.12c38","name":"Done","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","payload":"close","payloadType":"str","x":2110,"y":4040,"wires":[["90ccd6a0.6f9bf8"]]},{"id":"564db5d9.e3176c","type":"ui_group","z":"","name":"Flowchart","tab":"5f4849fa.9298f8","order":1,"disp":false,"width":"20","collapse":false},{"id":"5f4849fa.9298f8","type":"ui_tab","z":"","name":"Flowchart","icon":"photo","order":5,"disabled":false,"hidden":false}]
```

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 August 2020 11:15 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/6 "2020-08-27T11:15:42Z")

</div>

Error: Can't import. Not a JSON string.

Sorry.

Oh, a `debug` node would suffice for output.

Interesting.

Looking more at the code, there is/are/were 3 erroneous `'s at the end.  
Removed them and works.

---

<div class="post-metadata">

**Author:** ![ArneR](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arner/32/95658_2.png) [@ArneR](https://discourse.nodered.org/u/ArneR)\
**Post date:** [27 August 2020 11:17 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/7 "2020-08-27T11:17:57Z")

</div>

Modified the code in the above post 🙂

Programmers probably hate this. 😕

 ![Running char](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/4/041122c8c7c56aaa6328f4fdb5ca3fe096f7cb04.gif)  
(Watch te animation at the bottom right of the page.)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 August 2020 11:21 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/8 "2020-08-27T11:21:11Z")

</div>

Yeah, ok.

Alas it doesn't get me a useful output.

Could you help me in how to get it working with the `function` node code I posted?

Just for the sake of keeping it as small as possible, the code/node I posted is a lot better than .... 12 (?) nodes.

Oh, but on another thing:  
Good to see I am not the only one who uses `gate` nodes!

They are great for a lot of things.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 August 2020 11:22 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/9 "2020-08-27T11:22:24Z")

</div>

Have you put a debug on the output of the function node to see what is coming out?  
Have you read the docs guide on Writing Functions which includes suggestions for using `node.warn()` to help debug functions?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 August 2020 11:25 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/10 "2020-08-27T11:25:43Z")

</div>

> [@Colin](#):
>
> Have you put a debug on the output of the function node to see what is coming out?

In which scenario though?

If I make _the line of interest_  
`msg.payload = "\@0,0";`

I get:  
`@0,0`  
coming out of the node.

All others give their respective:  
`|@0,0`  
`/@0,0`  
`-@0,0`

How do I get the node to _spit out_ `\@0,0`?  
That is what I need to see coming out of the node.

I've looked on sites and tried to find the _magic_ to get the `\` working.

I don't know the words to phrase the question to get a useful result from google.

---

<div class="post-metadata">

**Author:** ![ArneR](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arner/32/95658_2.png) [@ArneR](https://discourse.nodered.org/u/ArneR)\
**Post date:** [27 August 2020 11:30 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/11 "2020-08-27T11:30:57Z")

</div>

![Running char V2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/7/c7b834279090c5c8df9272ef3d2684854e38c5a7.gif)

Your code does the job I think. Small adjustment:

```auto
if (x == 3)
{
    // 3
    msg.payload = "\\@0,0";
}

```

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 August 2020 11:30 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/12 "2020-08-27T11:30:58Z")

</div>

ARGH!

If I make the line:  
`\\@0,0` I get `\@0,0` sent out.

In the node when typing both the `\` were orange. So I thought that was..... another level of _magic_.

![Screenshot from 2020-08-27 21-29-13](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/a/6a0957de69c291ebd02cb689835fa3bde27e62c4.png)

21:30 local. I think I had better call it a night.

Sorry. I'm stupid. (But that's a given.)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 August 2020 11:33 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/13 "2020-08-27T11:33:01Z")

</div>

Not if I only have a single `\`. I need to make it double.

(That has opened another can of worms on the LCD. But it isn't critical.)

---

<div class="post-metadata">

**Author:** ![ArneR](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arner/32/95658_2.png) [@ArneR](https://discourse.nodered.org/u/ArneR)\
**Post date:** [27 August 2020 11:35 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/14 "2020-08-27T11:35:11Z")

</div>

Just out of curiosity, what's wrong on the screen now? 🙂

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 August 2020 11:39 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/15 "2020-08-27T11:39:32Z")

</div>

The LCD: when I send it a `\` I get a ..... _Yen_ symbol. Looks like a `Y` and a `=` mated.

This is not a big problem. This is a quick _animation_ that is done as the machine reboots or shuts down.

So it isn't as _smooth looking_ as it should be. It won't break the bank.

---

<div class="post-metadata">

**Author:** ![ArneR](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arner/32/95658_2.png) [@ArneR](https://discourse.nodered.org/u/ArneR)\
**Post date:** [27 August 2020 11:48 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/16 "2020-08-27T11:48:25Z")

</div>

I just called in google.  
Apparently backslash is not in it's ascii table.

You can get around it like this:

- Use LCD.createChar () function.
- Code: {0x00, 0x10, 0x08, 0x04, 0x02, 0x01, 0x00, 0x00}, // BACKSLASH

[More info and working code in the 5th post.](https://forum.arduino.cc/index.php?topic=403329.0)

This info comes from an arduino forum, no idea if you can apply this. Anyway, it's fixable 🙂

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 August 2020 11:51 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/17 "2020-08-27T11:51:36Z")

</div>

Thanks.

**This** isn't really the project.  
This display is one I have lying around.

I have a whole other _can of worms_ with the 20x4 LCD I bought getting it working on a RasPi via I2C command.  
Both are 3.3v, so don't panic.

A node I thought would just work isn't. Thought the person who wrote it has been helping me a lot.

But I think this (now) falls into _Tomorrow's_ realm.

I need some food and sleep.  
(But I will also need to learn how to upload characters too. But that is for the other display.)

---

<div class="post-metadata">

**Author:** ![ArneR](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arner/32/95658_2.png) [@ArneR](https://discourse.nodered.org/u/ArneR)\
**Post date:** [27 August 2020 12:01 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/18 "2020-08-27T12:01:12Z")

</div>

No idea if [this (click)](https://www.raspberrypi.org/forums/viewtopic.php?t=33387) works for your screen, but yeah ..  
Good Luck anyway!

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 August 2020 21:43 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/19 "2020-08-27T21:43:21Z")

</div>

It can't hurt.

~~Edited the file as was told by the person who wrote the node. Set it to 0x72 and the display is now doing things.~~

Ok, using your example code where it sends 4 lines of text, I just get _junk_ on the screen.  
For the sake of eliminating things, I adjust the `scroll speed`.

I change it, close the window and `DEPLOY`.  
The screen changes what it is showing. But it is still a mess. Nothing like what I am sending.

~~Mostly symbols.  
 ~~

Sorry. I got carried away. That was supposed to be for the person who wrote the node code.  
But to keep you _in the loop_ (if you want) progress has been made with the new display.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 September 2020 21:43 UTC](https://discourse.nodered.org/t/how-to-get-a-displayed-in-a-message/32091/20 "2020-09-10T21:43:26Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
