Start a new topic


With this code, does anyone know how to set the sleep time? it sleeps on startup, then it never goes back to sleep. Can I set it to sleep in 5000ms?


Ricardo Mena C

  This example code is in public domain


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

SoftwareSerial nextion(10, 11);// 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 screenOff = true;

void setup() {
  myNextion.init(); // send the initialization commands for Page 0


void loop() {
  screenOff = false;
  myNextion.sendCommand("dim=0"); //sleep=1
  String message = myNextion.listen(); //check for message

1 person has this question
1 Comment

plz give me example how set sleep from arduino. i want set sleep from button, that connected in arduino. This example not work  'Nextion' does not name a type

Login or Signup to post a comment