Start a new topic

sending command to arduino via simple button

I am trying to press a simple button on the nextion display and have that button write a string of text written in the arduino.

The codes below works great for the Dual-State button, but how do I get a simple button to send command?

Nextion: ///////////////////////////////////

//Button Output

printh 70

print "nodered~togbt0="



print "0"




print "1"


printh ff ff ff

Arduino: ///////////////////////////////////////////////

  if (message == "70 nodered~togbt1=1")
// (Display "Program#2):
  lcd.print("Program #2");
  lcd.print("Box Pickup");
  if (message == "70 nodered~togbt1=0")
// (Do not display "Program#1): //lcd.noDisplay() is not working?//

thank you for any advice.

Nextion Instruction Set

Also see CompButton or CompText example of Iteadlib

From Nextion you send

printh 70

print "nodered~togbt0="


but in Arduino you expect to receive

if (message == "70 nodered~togbt1=1")

I see three problems here:

- The command "printh 70" sends one byte 0x70, that means ASCII "p", not ASCII "70".

- You expect a space between "70" and "nodered...", but you don't send this space from Nextion.

- You send togbt0, but you expect togbt1.

In Arduino you have also


What is lcd? Is it Nextion?

Where is the function "setCursor" defined?

Login or Signup to post a comment