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 Cricardo@crcibernetica.comhttp://crcibernetica.com
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() { Serial.begin(9600); myNextion.init(); // send the initialization commands for Page 0
}
void loop() { if(screenOff){ screenOff = false; myNextion.sendCommand("dim=0"); //sleep=1 } String message = myNextion.listen(); //check for message if(message.startsWith("68")){ myNextion.sendCommand("sleep=0"); }}
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
anthony
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
ricardo@crcibernetica.com
http://crcibernetica.com
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() {
Serial.begin(9600);
myNextion.init(); // send the initialization commands for Page 0
}
void loop() {
if(screenOff){
screenOff = false;
myNextion.sendCommand("dim=0"); //sleep=1
}
String message = myNextion.listen(); //check for message
if(message.startsWith("68")){
myNextion.sendCommand("sleep=0");
}
}
1 person has this question