Comunication Nextion X Arduino MEGA 2560

Using the examples given have error loading the software on the Arduino.

Ricardo Mena C
ricardo@crcibernetica.com
http://crcibernetica.com

This example code is in public domain

*/

#include <SoftwareSerial.h>
#include <Nextion.h>

SoftwareSerial nextion(0, 1);// Nextion TX to pin 2 and RX to pin 3 of Arduino

Nextion myNextion(nextion, 9600); //create a Nextion object named myNextion using the nextion serial port @ 9600bps

boolean button1State;
boolean button2State;

// sensor “progress” bar
int x = 56;
int y = 321;
int width = 195;
int height = 8;

int old_sensor_value = 0;

void setup() {
Serial.begin(9600);
myNextion.init();
}

void loop() {

String message; //= myNextion.listen();

if (message == “65 0 2 0 ffff ffff ffff”) {
myNextion.buttonToggle(button1State, “b0”, 0, 2);
}
if (message == “65 0 3 0 ffff ffff ffff”) {
myNextion.buttonToggle(button2State, “b1”, 0, 2);
}

int sensor = 0;

for (int i = 0; i < 10 ; i ++) { // get average
sensor += analogRead(A0);
}
sensor = sensor / 10;

if (abs(sensor - old_sensor_value) > 20) {
old_sensor_value = sensor;

int scaled_value = map(sensor, 0, 1023, 0, 100); // always map value from 0 to 100

myNextion.updateProgressBar(x, y, width, height, scaled_value, 0, 2); // update the progress bar
myNextion.setComponentText(“t0”, String(sensor)); // update text using original sensor value

}
}

error
exit status 1
‘class Nextion’ has no member named ‘buttonToggle’

Please could send me an example that works between the HMI NEXTION and Arduino?
HMI 3.7 ".

Thank you

Nilson Schmitt
nilson@esarc.com.br