سلام بر استاید محترم سایت
من طبق دو عکس ضمیمه شده


با استفاده از اردوینو مگا و مازول ds3231 با کد زیر
تاریخ زمان و روز هفته جاری رو نمایش میدم
طبق عکس اولی چرا ثانیه شمار عوض میشه صفحه clear نمیشه ثانیه بعدی رو نمایش بده انگار روی هم ثانیه رو نمایش میده که به این شکل در میاد
ممنون میشم راهنماییم کنید
من طبق دو عکس ضمیمه شده


با استفاده از اردوینو مگا و مازول ds3231 با کد زیر
کد:
[FONT=Yekan]#include <Wire.h> //include Wire.h library[/FONT]#include "RTClib.h" //include Adafruit RTC library #include <Adafruit_GFX.h> #include <MCUFRIEND_kbv.h> #include <Fonts/FreeMonoBoldOblique12pt7b.h> MCUFRIEND_kbv tft(A3, A2, A1, A0, A4); uint16_t identifier; #define DARKBLUE 0x0010 #define VIOLET 0x8888 #define RED 0xF800 #define GREEN 0x07E0 #define CYAN 0x07FF #define MAGENTA 0xF81F #define YELLOW 0xFFE0 #define WHITE 0xFFFF #define GREY tft.color565(64, 64, 64); #define GOLD 0xFEA0 #define BROWN 0xA145 #define SILVER 0xC618 #define LIME 0x07E0 RTC_DS3231 rtc; //Make a RTC DS3231 object //Set the names of days char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; void setup () { Serial.begin(9600); //Begin the Serial at 9600 Baud //Print the message if RTC is not available if (! rtc.begin()) { Serial.println("Couldn't find RTC"); while (1); } //Setup of time if RTC lost power or time is not set if (rtc.lostPower()) { //Sets the code compilation time to RTC DS3231 rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); } Serial.begin(9600); tft.reset(); identifier = tft.readID(); tft.begin(identifier); tft.fillScreen(0xF800); tft.setRotation(1); tft.drawRoundRect(7, 7, 305, 220, 10, LIME); //Page border tft.setTextColor(0xFFFF); tft.setCursor(70,25); tft.setFont(&FreeMonoBoldOblique12pt7b); tft.setTextSize(0); } void loop () { //Set now as RTC time DateTime now = rtc.now(); tft.setCursor(90,25); //Print RTC time to Serial Monitor tft.print(now.year(), DEC); tft.print('/'); tft.print(now.month(), DEC); tft.print('/'); tft.print(now.day(), DEC); tft.println(); tft.setCursor(40,50); tft.print(" Week("); tft.print(daysOfTheWeek[now.dayOfTheWeek()]); tft.print(") "); tft.println(); tft.setCursor(90,75); tft.print(now.hour(), DEC); tft.print(':'); tft.print(now.minute(), DEC); tft.print(':'); tft.print(now.second(), DEC); //tft.invertDisplay(true); }
طبق عکس اولی چرا ثانیه شمار عوض میشه صفحه clear نمیشه ثانیه بعدی رو نمایش بده انگار روی هم ثانیه رو نمایش میده که به این شکل در میاد
ممنون میشم راهنماییم کنید
دیدگاه