Sentinel Logger (for Nextion displays)
- Using HardwareSerial for logging (for Arduino Mega/Due, etc.)
- Using SoftwareSerial for logging (for Arduino Uno/Nano/Mini, etc.)
- Using both at the same time.
- Scroll effect (When overloaded, the page is not cleared, but scrolls down 1 line)
1. Add Logger.h
and Logger.cpp
to your project
2. Download Sentinel[v1.0].tft
to your display
- Software serial
#include "Logger.h"
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);
Logger softwareLogger(mySerial); // 1. Initialize logger
void setup() {
...
softwareLogger.begin(9600); // 2. Begin serial
...
}
void loop() {
...
if (Serial.available()) {
String command = Serial.readStringUntil("\n");
softwareLogger.log(command); // 3. Log
}
...
}
- Hardware serial
#include "Logger.h"
Logger hardwareLogger(Serial2); // 1. Initialize logger
void setup() {
...
hardwareLogger.begin(9600); // 2. Begin serial
...
}
void loop() {
...
if (Serial.available()) {
String command = Serial.readStringUntil("\n");
hardwareLogger.log(command); // 3. Log
}
...
}
There is nothing easier than using them.
/* Somewhere in your code: */
...
myLogger.log("<command>")
...
There are 2 basic commands:
-
clear
- erase all logs in your session, it doesn't create a new session -
page <PageID>
- go to a specific page:- Logger - Terminal Page, creates a new session
- Main - Lobby, closes an existing session
If you don't have to wait for your board to connect, you can skip this screen, just call skipLobby()
in
your setup()
:
void setup() {
...
myLogger.skipLoading();
...
}