• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
RTC DS1307 Problemy z biblioteką
#1
Chce użyć modułu RTC DS1307 do pewnego projektu jednak mam problem z opanowaniem samego tego modułu, a dokładniej samych bibliotek. Mianowicie robiąc wszystko tak jak ElektroMaras wyskakuje mi błąd kompilacji programu :/

Jest napisane coś takiego:
C:\Users\Olek\Documents\Arduino\libraries\Time\DateStrings.cpp:59:24: error: variable 'dayShortNames_P' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

 char dayShortNames_P[] PROGMEM = "ErrSunMonTueWedThrFriSat";

                        ^

exit status 1
Błąd kompilacji.


Używam biblioteki podanej przez ElektroMarasa DS1307RTC pobranego z jego dysku:   https://drive.google.com/folderview?id=0...kN4bk5neFk

Ktoś może mi wyjaśnić czemu wyskakuje błąd tej kompilacji?
 
Odpowiedź
#2
Daj cały kod
Ważne aby robić co się lubi albo lubić co się robi .
Arduino UNO, TINY, PRO MINI
Pomoc nagradzamy punktami reputacji Wink
 
Odpowiedź
#3
Kod:
#include <Time.h>  
#include <Wire.h>  
#include <DS1307RTC.h>  

void setup()  {
 Serial.begin(9600);
 while (!Serial) ; // Needed for Leonardo only
 setSyncProvider(RTC.get);   // the function to get the time from the RTC
 if (timeStatus() != timeSet)
    Serial.println("Unable to sync with the RTC");
 else
    Serial.println("RTC has set the system time");      
}

void loop()
{
 if (Serial.available()) {
   time_t t = processSyncMessage();
   if (t != 0) {
     RTC.set(t);  
     setTime(t);          
   }
 }
 digitalClockDisplay();  
 delay(1000);
}

void digitalClockDisplay(){
 // digital clock display of the time
 Serial.print(hour());
 printDigits(minute());
 printDigits(second());
 Serial.print(" ");
 Serial.print(day());
 Serial.print(" ");
 Serial.print(month());
 Serial.print(" ");
 Serial.print(year());
 Serial.println();
}

void printDigits(int digits){
 // utility function for digital clock display: prints preceding colon and leading 0
 Serial.print(":");
 if(digits < 10)
   Serial.print('0');
 Serial.print(digits);
}


#define TIME_HEADER  "T"  
unsigned long processSyncMessage() {
 unsigned long pctime = 0L;
 const unsigned long DEFAULT_TIME = 1357041600;

 if(Serial.find(TIME_HEADER)) {
    pctime = Serial.parseInt();
    return pctime;
    if( pctime < DEFAULT_TIME) {
      pctime = 0L;
    }
 }
 return pctime;
}
Wszystkie biblioteki mam dodane
 
Odpowiedź
#4
zmień program na 1.5.8 u mnie kompiluje poprawnie
Ważne aby robić co się lubi albo lubić co się robi .
Arduino UNO, TINY, PRO MINI
Pomoc nagradzamy punktami reputacji Wink
 
Odpowiedź
#5
Tu rozchodzi się o bibliotekę "Time" plik DateStrings.cpp Kompilator chce "const "przed dayShortNames_P a tam go niema
char dayShortNames_P[] PROGMEM = "ErrSunMonTueWedThrFriSat";
Pozwoliłem sobie pobrać i zobaczyć choć już późno .
 
Odpowiedź
  


Skocz do:


Przeglądający: 1 gości