Product Preview: Nextion in an Arduino project (3)

In the previous blog, we demonstrate how to use Arduino to control a progress bar that shows on Nextion 2.4”. In that case, we use progress bar and text components in Nextion Editor. In this blog, we will tell you the other simple component – button. When you touch the area that is under the button component “monitor”, it will run the ID of this component, then you can realize some visual final effects like interface switching, sending data through serial port.

Hardware we use

  • Iteaduino UNO
  • Nextion 2.4″

Download the HMI file here: Touch_switch_Project

Code we use to Arduino UNO:

int char1,char2;
int charflag=0;

void setup() {

void loop() {
 if (Serial.available()>1) 
 if (charflag)  
  if (char2==0) digitalWrite(13,HIGH);
  else if (char2==0x01) digitalWrite(13,LOW);
   if(char1==0x65) charflag=1;

Leave a Reply

%d bloggers like this: