# How to use oled node

**URL:** <https://discourse.nodered.org/t/how-to-use-oled-node/5423>\
**Category:** General\
**Created:** [2 December 2018 22:37 UTC](https://discourse.nodered.org/t/how-to-use-oled-node/5423 "2018-12-02T22:37:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenkoknz](https://avatars.discourse-cdn.com/v4/letter/k/58956e/32.png) [@kenkoknz](https://discourse.nodered.org/u/kenkoknz)\
**Post date:** [2 December 2018 22:37 UTC](https://discourse.nodered.org/t/how-to-use-oled-node/5423/1 "2018-12-02T22:37:01Z")

</div>

Hi,  
Installed node-red-contrib-oled and managed to display a string "hello world" with inject node with json payload of { "size":3, "x":1,"y":1,"text":"hello world"}.  
(The format obviously require size and x y coordinates to be set.)

How do I replace just the "hello world" with a variable, so I can display the variable?

Thanks,

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [2 December 2018 22:48 UTC](https://discourse.nodered.org/t/how-to-use-oled-node/5423/2 "2018-12-02T22:48:16Z")

</div>

Hi @kenkoknz

there are a number of ways you can create such an payload. Here are just some using the core nodes available in the palette. Each uses a slightly different syntax. All of these examples assume the text you want to display is in `msg.payload` and you want to create the JS Object as you describe to wrap it.

1. A Template node can be used to provide some template text with parts replaced by values provided by the received message. For example, the following template would insert the value of msg.payload into the template (and by default, the Template node sets msg.payload with the result). You would also need to configure the node to 'output as Parsed JSON'

2. A Change node can be do it by configuring it to set msg.payload to the JSONata expression:

3. A Function node is the all-purpose node where you can write whatever javascript you want:

---

<div class="post-metadata">

**Author:** ![kenkoknz](https://avatars.discourse-cdn.com/v4/letter/k/58956e/32.png) [@kenkoknz](https://discourse.nodered.org/u/kenkoknz)\
**Post date:** [3 December 2018 00:54 UTC](https://discourse.nodered.org/t/how-to-use-oled-node/5423/3 "2018-12-03T00:54:06Z")

</div>

Hi @knolleary  
Firstly, really appreciate such quick response, as I live in NZ, I tought it is middle of the night elsewhere in the world and everyone is asleep when I posted.

This is magic! I ve spent the last two days searching the internet, but getting frustrated and more confused. Your advise is invaluable for a beginner like me and the best way to learn is by example (as shown by you). One example worth a thousand words.

I used the change node and hey presto it works.  
I think I did try the change node before with the same json object, but I think I used "json" instead of "expression type". Have to admit I do not quite understand jsonata.

Also tried the function node and also works, it makes sense.

Do not quite understand the template node and why {{ }} the payload.

Thanks again.

Ken Kok  
NZ

---

<div class="post-metadata">

**Author:** ![mandebooks](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mandebooks/32/14238_2.png) [@mandebooks](https://discourse.nodered.org/u/mandebooks)\
**Post date:** [13 November 2019 04:11 UTC](https://discourse.nodered.org/t/how-to-use-oled-node/5423/4 "2019-11-13T04:11:12Z")

</div>

Has anyone figured out a way to rotate the OLED screen?
