problème ( Initialize DS3231)

bonjour,

mon petit soucie et que dans le moniteur sérié il m’affiche Initialize DS3231 au lieu de m’afficher heur et la date

le programme et le câblage je les pris sur le cd livré ac mon arduino mega 2560 R3

le pdf de schéma de câblage me dit:

Ignorez les broches 32k et SQW; vous ne en Aurez Pas besoin. Insérez la broche SCL au port A5 de Votre carte d’Mega2560 R3, et la broche SDA au port A4. La broche VCC is insérée au port 5v, et la broche GND is insérée au GND du port.

Le code

//www.elegoo.com
//2016.06.13

/*
  DS3231: Real-Time Clock. Simple example
  Read more: www.jarzebski.pl/arduino/komponenty/zegar-czasu-rzeczywistego-rtc-ds3231.html
  GIT: https://github.com/jarzebski/Arduino-DS3231
  Web: http://www.jarzebski.pl
  (c) 2014 by Korneliusz Jarzebski
*/

#include <Wire.h>
#include <DS3231.h>

DS3231 clock;
RTCDateTime dt;

void setup()
{
  Serial.begin(9600);

  // Initialize DS3231
  Serial.println("Initialize DS3231");;
  clock.begin();

  // Set sketch compiling time
  clock.setDateTime(__DATE__, __TIME__);
}

void loop()
{
  dt = clock.getDateTime();

  // For leading zero look to DS3231_dateformat example

  Serial.print("Raw data: ");
  Serial.print(dt.year);   Serial.print("-");
  Serial.print(dt.month);  Serial.print("-");
  Serial.print(dt.day);    Serial.print(" ");
  Serial.print(dt.hour);   Serial.print(":");
  Serial.print(dt.minute); Serial.print(":");
  Serial.print(dt.second); Serial.println("");

  delay(1000);
}

et dans compilation téminée sa me dit sa :

quand je vérifier le programme ou je le charge dans arduino il me marque se-ici :

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1206:11: warning: extra tokens at end of #endif directive

     #endif;

           ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp: In member function 'char* DS3231::dateFormat(const char*, RTCDateTime)':

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:173:10: warning: address of local variable 'buffer' returned [-Wreturn-local-addr]

     char buffer[255];

          ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp: In member function 'char* DS3231::dateFormat(const char*, RTCAlarmTime)':

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:301:10: warning: address of local variable 'buffer' returned [-Wreturn-local-addr]

     char buffer[255];

          ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp: In member function 'char* DS3231::strDayOfWeek(uint8_t)':

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:960:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "Monday";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:963:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "Tuesday";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:966:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "Wednesday";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:969:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "Thursday";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:972:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "Friday";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:975:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "Saturday";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:978:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "Sunday";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:981:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "Unknown";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp: In member function 'char* DS3231::strMonth(uint8_t)':

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:989:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "January";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:992:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "February";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:995:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "March";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:998:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "April";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1001:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "May";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1004:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "June";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1007:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "July";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1010:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "August";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1013:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "September";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1016:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "October";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1019:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "November";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1022:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "December";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1025:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "Unknown";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp: In member function 'char* DS3231::strAmPm(uint8_t, bool)':

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1035:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "AM";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1038:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "am";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1044:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "PM";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1047:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             return "pm";

                    ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp: In member function 'char* DS3231::strDaySufix(uint8_t)':

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1056:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         return "st";

                ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1060:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         return "nd";

                ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1064:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         return "rd";

                ^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1067:12: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     return "th";

            ^


Le croquis utilise 5 232 octets (2%) de l'espace de stockage de programmes. Le maximum est de 253 952 octets.
Les variables globales utilisent 472 octets (5%) de mémoire dynamique, ce qui laisse 7 720 octets pour les variables locales. Le maximum est de 8 192 octets.

PAS DE DOUBLE POST SVP...

Je vous ai répondu un truc à effectuer sur votre autre post

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:1206:11: warning: extra tokens at end of #endif directive

#endif;

^

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp: In member function ‘char* DS3231::dateFormat(const char*, RTCDateTime)’:

C:\Users\programme\Documents\Arduino\libraries\DS3231\DS3231.cpp:173:10: warning: address of local variable ‘buffer’ returned [-Wreturn-local-addr]

char buffer[255]; …

it means, there is an error in the library DS3231.cpp

try to use corrected file DS3231.cpp in the attachment:

DS3231.cpp (26.5 KB)

DS3231.cpp (26.5 KB)