I am using an Arduino Mega to display the readings of 4 pots on a Nextion Display as well as store it inthem on an SD Card with thea time stamp. I keep getting:
recvRetCommandFinished errrecvRetCommandFinished err
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack ExchangeStack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Explore Stack InternalI am using an Arduino Mega to display the readings of 4 pots on a Nextion Display as well as store it inthem on an SD Card with thea time stamp. I keep getting:
recvRetCommandFinished errrecvRetCommandFinished err
I am using an Arduino Mega to display the readings of 4 pots on a Nextion Display as well as store it in an SD Card with the time stamp. I keep getting:
recvRetCommandFinished errI am using an Arduino Mega to display the readings of 4 pots on a Nextion Display as well as store them on an SD Card with a time stamp. I keep getting:
recvRetCommandFinished err
I am using an Arduino Mega to display the readings of 4 pots on a Nextion Display as well as store it in an SD Card with the time stamp. I keep getting:
recvRetCommandFinished err
recvRetCommandFinished err #include "Nextion.h"
#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 rtc;
char daysOfTheWeek[7][12] = {"Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
// Declare your Nextion objects - Example (page id = 0, component id = 1, component name = "b0")
NexText tDate = NexText(0, 1, "tDate");
NexText tPot1 = NexText(0, 6, "tPot1");
NexText tPot2 = NexText(0,7, "tPot2");
NexText tPot3 = NexText(0, 8, "tPot3");
NexText tPot4 = NexText(0, 9, "tPot4");
File myFile;
void setup(void) {
Serial1.begin(9600);
// Open serial communications and wait for port to open:
Serial.begin(9600);
if (! rtc.begin())
{
Serial.println("Couldn't find RTC");
while (1);
}
if (! rtc.isrunning())
{
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
//rtc.adjust(DateTime(2016, 11, 19, 19, 45, 0)); // <----------------------SET TIME AND DATE: YYYY,MM,DD,HH,MM,SS
}
delay(100);
// You might need to change NexConfig.h file in your ITEADLIB_Arduino_Nextion folder
// Set the baudrate which is for debug and communicate with Nextion screen
nexInit();
SPI.begin();
int pot1 = 0;
int pot2 = 0;
int pot3 = 0;
int pot4 = 0;
while (!Serial)
{
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
if (!SD.begin(53))
{
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
}
void loop(void) {
myFile = SD.open("testpot1.csv", FILE_WRITE);
// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to testpot1.txt...");
while(1){
DateTime now = rtc.now();
myFile = SD.open("testpot1.csv ", FILE_WRITE);
int pot1 = analogRead(A0);
int pot2 = analogRead(A1);
int pot3 = analogRead(A2);
int pot4 = analogRead(A3);
myFile.print(now.hour());
myFile.print(":");
myFile.print(now.minute());
myFile.print(",");
myFile.println(pot1);
myFile.println(",");
tPot1.setText(pot1);
myFile.println(pot2);
myFile.println(",");
tPot2.setText(pot2);
myFile.println(pot3);
myFile.println(",");
tPot3.setText(pot3);
myFile.println(pot4);
myFile.println(",");
tPot4.setText(pot4);
Serial.print(pot1);
Serial.print(",");
Serial.print(pot2);
Serial.print(",");
Serial.print(pot3);
Serial.print(",");
Serial.print(pot4);
Serial.print(",");
delay(2000);
myFile.close();
}
}
else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}
#include "Nextion.h"
#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 rtc;
char daysOfTheWeek[7][12] = {"Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
// Declare your Nextion objects - Example (page id = 0, component id = 1, component name = "b0")
NexText tDate = NexText(0, 1, "tDate");
NexText tPot1 = NexText(0, 6, "tPot1");
NexText tPot2 = NexText(0,7, "tPot2");
NexText tPot3 = NexText(0, 8, "tPot3");
NexText tPot4 = NexText(0, 9, "tPot4");
File myFile;
void setup(void) {
Serial1.begin(9600);
// Open serial communications and wait for port to open:
Serial.begin(9600);
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
if (! rtc.isrunning()) {
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
//rtc.adjust(DateTime(2016, 11, 19, 19, 45, 0)); // <----------------------SET TIME AND DATE: YYYY,MM,DD,HH,MM,SS
}
delay(100);
// You might need to change NexConfig.h file in your ITEADLIB_Arduino_Nextion folder
// Set the baudrate which is for debug and communicate with Nextion screen
nexInit();
SPI.begin();
int pot1 = 0;
int pot2 = 0;
int pot3 = 0;
int pot4 = 0;
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
if (!SD.begin(53)) {
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
}
void loop(void) {
myFile = SD.open("testpot1.csv", FILE_WRITE);
// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to testpot1.txt...");
while(1) {
DateTime now = rtc.now();
myFile = SD.open("testpot1.csv ", FILE_WRITE);
int pot1 = analogRead(A0);
int pot2 = analogRead(A1);
int pot3 = analogRead(A2);
int pot4 = analogRead(A3);
myFile.print(now.hour());
myFile.print(":");
myFile.print(now.minute());
myFile.print(",");
myFile.println(pot1);
myFile.println(",");
tPot1.setText(pot1);
myFile.println(pot2);
myFile.println(",");
tPot2.setText(pot2);
myFile.println(pot3);
myFile.println(",");
tPot3.setText(pot3);
myFile.println(pot4);
myFile.println(",");
tPot4.setText(pot4);
Serial.print(pot1);
Serial.print(",");
Serial.print(pot2);
Serial.print(",");
Serial.print(pot3);
Serial.print(",");
Serial.print(pot4);
Serial.print(",");
delay(2000);
myFile.close();
}
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}
I am using an Arduino Mega to display the readings of 4 pots on a Nextion Display as well as store it in an SD Card with the time stamp. I keep getting
recvRetCommandFinished err
#include "Nextion.h"
#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 rtc;
char daysOfTheWeek[7][12] = {"Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
// Declare your Nextion objects - Example (page id = 0, component id = 1, component name = "b0")
NexText tDate = NexText(0, 1, "tDate");
NexText tPot1 = NexText(0, 6, "tPot1");
NexText tPot2 = NexText(0,7, "tPot2");
NexText tPot3 = NexText(0, 8, "tPot3");
NexText tPot4 = NexText(0, 9, "tPot4");
File myFile;
void setup(void) {
Serial1.begin(9600);
// Open serial communications and wait for port to open:
Serial.begin(9600);
if (! rtc.begin())
{
Serial.println("Couldn't find RTC");
while (1);
}
if (! rtc.isrunning())
{
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
//rtc.adjust(DateTime(2016, 11, 19, 19, 45, 0)); // <----------------------SET TIME AND DATE: YYYY,MM,DD,HH,MM,SS
}
delay(100);
// You might need to change NexConfig.h file in your ITEADLIB_Arduino_Nextion folder
// Set the baudrate which is for debug and communicate with Nextion screen
nexInit();
SPI.begin();
int pot1 = 0;
int pot2 = 0;
int pot3 = 0;
int pot4 = 0;
while (!Serial)
{
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
if (!SD.begin(53))
{
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
}
void loop(void) {
myFile = SD.open("testpot1.csv", FILE_WRITE);
// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to testpot1.txt...");
while(1){
DateTime now = rtc.now();
myFile = SD.open("testpot1.csv ", FILE_WRITE);
int pot1 = analogRead(A0);
int pot2 = analogRead(A1);
int pot3 = analogRead(A2);
int pot4 = analogRead(A3);
myFile.print(now.hour());
myFile.print(":");
myFile.print(now.minute());
myFile.print(",");
myFile.println(pot1);
myFile.println(",");
tPot1.setText(pot1);
myFile.println(pot2);
myFile.println(",");
tPot2.setText(pot2);
myFile.println(pot3);
myFile.println(",");
tPot3.setText(pot3);
myFile.println(pot4);
myFile.println(",");
tPot4.setText(pot4);
Serial.print(pot1);
Serial.print(",");
Serial.print(pot2);
Serial.print(",");
Serial.print(pot3);
Serial.print(",");
Serial.print(pot4);
Serial.print(",");
delay(2000);
myFile.close();
}
}
else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}
I am using an Arduino Mega to display the readings of 4 pots on a Nextion Display as well as store it in an SD Card with the time stamp. I keep getting:
recvRetCommandFinished err#include "Nextion.h"
#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 rtc;
char daysOfTheWeek[7][12] = {"Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
// Declare your Nextion objects - Example (page id = 0, component id = 1, component name = "b0")
NexText tDate = NexText(0, 1, "tDate");
NexText tPot1 = NexText(0, 6, "tPot1");
NexText tPot2 = NexText(0,7, "tPot2");
NexText tPot3 = NexText(0, 8, "tPot3");
NexText tPot4 = NexText(0, 9, "tPot4");
File myFile;
void setup(void) {
Serial1.begin(9600);
// Open serial communications and wait for port to open:
Serial.begin(9600);
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
if (! rtc.isrunning()) {
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
//rtc.adjust(DateTime(2016, 11, 19, 19, 45, 0)); // <----------------------SET TIME AND DATE: YYYY,MM,DD,HH,MM,SS
}
delay(100);
// You might need to change NexConfig.h file in your ITEADLIB_Arduino_Nextion folder
// Set the baudrate which is for debug and communicate with Nextion screen
nexInit();
SPI.begin();
int pot1 = 0;
int pot2 = 0;
int pot3 = 0;
int pot4 = 0;
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
if (!SD.begin(53)) {
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
}
void loop(void) {
myFile = SD.open("testpot1.csv", FILE_WRITE);
// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to testpot1.txt...");
while(1) {
DateTime now = rtc.now();
myFile = SD.open("testpot1.csv ", FILE_WRITE);
int pot1 = analogRead(A0);
int pot2 = analogRead(A1);
int pot3 = analogRead(A2);
int pot4 = analogRead(A3);
myFile.print(now.hour());
myFile.print(":");
myFile.print(now.minute());
myFile.print(",");
myFile.println(pot1);
myFile.println(",");
tPot1.setText(pot1);
myFile.println(pot2);
myFile.println(",");
tPot2.setText(pot2);
myFile.println(pot3);
myFile.println(",");
tPot3.setText(pot3);
myFile.println(pot4);
myFile.println(",");
tPot4.setText(pot4);
Serial.print(pot1);
Serial.print(",");
Serial.print(pot2);
Serial.print(",");
Serial.print(pot3);
Serial.print(",");
Serial.print(pot4);
Serial.print(",");
delay(2000);
myFile.close();
}
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}
I am using an Arduino Mega to display the readings of 4 pots on a Nextion Display as well as store it in an SD Card with the time stamp. I keep getting
recvRetCommandFinished err
on the serial monitor and the display does not update with time.
I have attached my code below:
#include "Nextion.h"
#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 rtc;
char daysOfTheWeek[7][12] = {"Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
// Declare your Nextion objects - Example (page id = 0, component id = 1, component name = "b0")
NexText tDate = NexText(0, 1, "tDate");
NexText tPot1 = NexText(0, 6, "tPot1");
NexText tPot2 = NexText(0,7, "tPot2");
NexText tPot3 = NexText(0, 8, "tPot3");
NexText tPot4 = NexText(0, 9, "tPot4");
File myFile;
void setup(void) {
Serial1.begin(9600);
// Open serial communications and wait for port to open:
Serial.begin(9600);
if (! rtc.begin())
{
Serial.println("Couldn't find RTC");
while (1);
}
if (! rtc.isrunning())
{
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
//rtc.adjust(DateTime(2016, 11, 19, 19, 45, 0)); // <----------------------SET TIME AND DATE: YYYY,MM,DD,HH,MM,SS
}
delay(100);
// You might need to change NexConfig.h file in your ITEADLIB_Arduino_Nextion folder
// Set the baudrate which is for debug and communicate with Nextion screen
nexInit();
SPI.begin();
int pot1 = 0;
int pot2 = 0;
int pot3 = 0;
int pot4 = 0;
while (!Serial)
{
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
if (!SD.begin(53))
{
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
}
void loop(void) {
myFile = SD.open("testpot1.csv", FILE_WRITE);
// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to testpot1.txt...");
while(1){
DateTime now = rtc.now();
myFile = SD.open("testpot1.csv ", FILE_WRITE);
int pot1 = analogRead(A0);
int pot2 = analogRead(A1);
int pot3 = analogRead(A2);
int pot4 = analogRead(A3);
myFile.print(now.hour());
myFile.print(":");
myFile.print(now.minute());
myFile.print(",");
myFile.println(pot1);
myFile.println(",");
tPot1.setText(pot1);
myFile.println(pot2);
myFile.println(",");
tPot2.setText(pot2);
myFile.println(pot3);
myFile.println(",");
tPot3.setText(pot3);
myFile.println(pot4);
myFile.println(",");
tPot4.setText(pot4);
Serial.print(pot1);
Serial.print(",");
Serial.print(pot2);
Serial.print(",");
Serial.print(pot3);
Serial.print(",");
Serial.print(pot4);
Serial.print(",");
delay(2000);
myFile.close();
}
}
else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}
How do I get the pot values on my display? Any help or tips would be helpful!