How to get a `\` displayed in a message

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.

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

Have a look at the animated icons here

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 .

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.

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. :frowning:
Sorry.

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

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

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

Flow:

[{"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}]

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.

Modified the code in the above post :slight_smile:

Programmers probably hate this. :confused:


(Watch te animation at the bottom right of the page.)

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.

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?

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.

Running char V2

Your code does the job I think. Small adjustment:

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

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

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

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

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.)

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

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.

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.

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

1 Like

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.)

No idea if this (click) works for your screen, but yeah ..
Good Luck anyway!

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.

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