Start a new topic

How to view RTC on Nextion Basic

Good day, I'm a beginner I can not create RTC on my nextione basic. Module DS DS3231 When I've downloaded a lot of projects, none of me works and it shows me. Would someone introduce me to a functional ino + HMI?

Edited to English:  Please ensure posts are made in English.


sorry this is an international forum. Please post in english ...

    - English used, let others be able to read ...
    - English used, the chance to get answers is much higher ...
    - English used, people even can find when using the search ...

If you like to get help, you also should do your own to present your questions in it's best way.

 

First step, take your Arduino and your RTC module and bring them to work together. Without display, you might check things over the serial monitor. When that works, you take the Nextion editor, create the display elements and upload these to the display. In a last step, write the Arduino code to update the display over the serial connection.

Such projects can not be done just by copy and paste everything together, systematic development and structured coding skills are required.

On your Nextion you need to make a few textboxes.

I made them like this: t0=hours,t1=minutes,t2=secondes. On my background I made separations like this :

They are used between hours and minutes and, of course between the minutes and secondes.


It is important to know wich library you are going to use. In my case it is the RTClib frm Adafruit.

The next thing you want to do is creating a Arduino code.


This is mine:


Serial2.print("t0.txt=\"");  
 if(now.hour()<10)
  {
  Serial2.print("0");
  }
 Serial2.print(now.hour());
 Serial2.print("\"\xFF\xFF\xFF");
 Serial2.print("t1.txt=\""); 
 if(now.minute()<10)
  {
  Serial2.print("0");
  }
 Serial2.print(now.minute());
 Serial2.print("\"\xFF\xFF\xFF");
 Serial2.print("t2.txt=\"");  
 if(now.second()<10)
  {
  Serial2.print("0");
  }
 Serial2.print(now.second());
 Serial2.print("\"\xFF\xFF\xFF");
 Serial2.print("t4.txt=\"");  
 Serial2.print(now.day());
 Serial2.print("-");
 Serial2.print(now.month());
 Serial2.print("-");
 Serial2.print(now.year());
 Serial2.print("\"\xFF\xFF\xFF");


Greetings,

Ben Vogelzang.



1 person likes this

I'm sorry, I forgot to mention that txtbox t4 is for day, month, year.


1 person likes this

;)


I have sketched this code but write this error to me: Serial2.print ("\" \ XFF \ XFF \ XFF ");

Ben has no spaces in his


Serial2.print("\"\xFF\xFF\xFF");

Excuse me for interfering on this Topic.

There might be an other important issue. I don't know wich Serial port you are using. In my case it's Serial2 but that could be different on your side. I am,btw, using an Arduino Mega. You might have to check that.


Greetings,

Ben Vogelzang.

Login or Signup to post a comment