Start a new topic

Change Text Color from Arduino

How do I change the text color and text label when a button is pressed on an Arduino.

Is there something like t0.setColor(RED) or t0.setText("Hello World")?

1 person likes this idea

you want to send t0.pco=# where # is the color you want to set the text to (RED=63488), then refresh t0


ref t0

Thanks Patrick, I will try this tonight. Is there a list anywhere of the accepted commands or do I need to go through the library to determine what can be sent and received?

I receive a compile error as the Arduino code doesn't recognize pco. I want to do the following within my Arduino code:

if (digitalRead(buttonPin) == HIGH)


t0.pco=63488;                            //change color of text to RED

ref t0



Has anyone got this worked out? I'm trying to do the same thing using an Arduino Uno.

The error message I get is 'class NexText' has no member named 'pco'

Any help is greatly appreciated.

Your Arduino will not know what variables are in your HMI on the Nextion

you have to send the commands t0.pco=63488 and ref t0 over serial

There is no indication you attempted that in your code

How is library dependent - search your library code for an example, and duplicate

Never mind I found the solution from Spirko.

Thanks anyways.


Why not post your solution for when others are looking for a solution?

For those looking the thread Gene used  was found here:


Login or Signup to post a comment