Solved: RTC Zugriff nicht möglich ("RTC was not declared")

Hallo,

ich versuche einen alten sketch für eine Wordclock wieder zu benutzen, aber der Zugriff auf die RTC mit der (zumindest damals) genutzen Funktion setSyncProvider(RTC.get); scheint nicht mehr richtig oder eine neue Deklaration ist notwendig...??

Das ist der Fehler: Compilation error: 'RTC' was not declared in this scope

Danke
Arne

#include <DS3232RTC.h> //https://github.com/JChristensen/DS3232RTC
#include <TimeLib.h> //https://github.com/PaulStoffregen/Time
//#include <I2C_RTC.h>
#include <Wire.h>
#include <FastLED.h> //https://github.com/FastLED/FastLED
// DCF77 and RTC test sketch by 'jurs' for Arduino forum
// hardware required:
// RTC module: DS1307 or DS3231
// DCF77 module


// begin of user configuration area
#define DEBUGMODE 0  // 1 or 0 to show or not show debug messages
#define DCFPIN 8     // data pin of DCF77 module
#define DCF_INPUTMODE INPUT_PULLUP  // INPUT or INPUT_PULLUP
#define INVERTEDSIGNAL true  // false= normal signal, true= inverted signal
// end of user configuration area

#include "jursDCFtime.h"

FASTLED_USING_NAMESPACE
#define DATA_PIN    3
#define LED_TYPE    WS2812B
#define COLOR_ORDER GRB
#define NUM_LEDS    114      // Gesamtanzahl der WS2812 LEDs
CRGB leds[NUM_LEDS];

uint8_t maxBrightness     = 35;  // Wenn Fotoresistor benutzt wird, hier min. Helligkeit eintragen (0=Off->255=max)
uint8_t minBrightness     = 210;   // Wenn Fotoresistor benutzt wird, hier max. Helligkeit eintragen (0=Off->255=max)
uint8_t AmbientLightPin   = 0;    // Fotoresistor Pin
uint8_t BRIGHTNESS        = 150;  // Wenn kein Fotoresistor benutzt wird hier dauerhafte Helligkeit eintragen

uint8_t Stunde     = 0;
uint8_t Stunde_DCF      = 10;
uint8_t Minute     = 15;
uint8_t WochenTag  = 0;
int Jahr        = 1970;
uint8_t Tag        = 30;
uint8_t Monat      = 10;
//boolean DST        = false;

void DCF();
void nextPattern();
void intro();

//***HIER LED POSITIONEN EINTRAGEN***//
int Es[]        = {0, 1};
int Ist[]       = {3, 4, 5};
int Eins[]      = {62, 63, 64, 65};
int Ein[]       = {63, 64, 65};
int Zwei[]      = {55, 56, 57, 58};
int Drei[]      = {66, 67, 68, 69};
int Vier[]      = {73, 74, 75, 76};
int Fuenf[]     = {51, 52, 53, 54};
int Sechs[]     = {83, 84, 85, 86, 87};
int Sieben[]    = {88, 89, 90, 91, 92, 93};
int Acht[]      = {77, 78, 79, 80};
int Neun[]      = {44, 45, 46, 47};
int Zehn[]      = {106, 107, 108, 109};
int Elf[]       = {59, 60, 61};
int Zwoelf[]    = {94, 95, 96, 97, 98};
int MZwanzig[]  = {11, 12, 13, 14, 15, 16, 17};
int MFuenf1[]    = {8};
int MFuenf2[]    = {9};
int MFuenf3[]    = {10};
int MFuenf4[]    = {11};
int MZehn[]     = {22, 23, 24, 25};
int MFuenf[]     = {7, 8, 9, 10};
int Viertel[]   = {26, 27, 28, 29, 30, 31, 32};
int Vor[]       = {37, 38, 39};
int Nach[]      = {40, 41, 42, 43};
int Halb[]      = {33, 34, 35, 36};
int Uhr[]       = {99, 100, 101};
int Und[]       = {19, 20, 21};

int FuerH[]     = {21, 50, 101};

int EinsM[]     = {110}; //Minuten Punkt 1
int ZweiM[]     = {111}; //Minuten Punkt 2
int DreiM[]     = {112}; //Minuten Punkt 3
int VierM[]     = {113}; //Minuten Punkt 4
//**********************************//

int i, Ambient, LastAmbient;
unsigned long lastPrintTimeMillis;

//light effects
// List of patterns to cycle through.  Each is defined as a separate function below.
typedef void (*SimplePatternList[])();
void rainbow();
void rainbowWithGlitter();
void confetti();
void sinelon();
void bpm();
void juggle();
SimplePatternList gPatterns = {rainbow, rainbowWithGlitter, confetti, sinelon, bpm, juggle};

uint8_t gCurrentPatternNumber = 0; // Index number of which pattern is current
uint8_t gHue = 0; // rotating "base color" used by many of the patterns
uint8_t var_t;
//light effects end

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

void setup() {
  delay(3000); // Sicherheits Delay
  Serial.begin(19200);

  //DCF
  Serial.println(F("\nDCF77 and RTC test sketch by 'jurs'"));
  if (RTCinit()) Serial.println(F("RTC OK"));
  else Serial.println(F("RTC FAIL"));
  pinMode(DCFPIN, DCF_INPUTMODE);

  //DCF Ende

  //LEDs werden eingefügt + Farbkorrektur und Farbtemperatur auf Wolfram (warmweiß)
  FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalPixelString);
  FastLED.setTemperature( Tungsten40W );
  Serial.println("Starte Wordclock ...");

  //Versuche auf RTC zu zugreifen
  setSyncProvider(RTC.get);
  if (timeStatus() != timeSet) {
    Serial.println("Unable to sync with the RTC");
  } else if (timeStatus() != timeNeedsSync) {
    Serial.println("RTC has set the system time");
  } else {
    Serial.println("RTC has set the system time but needs Sync");
  }
}

Da fehlt mindestens eine Zeile in der Art

DS3232RTC RTC;

oder so ähnlich.

Siehe Important note: Library v2.0.0:

The library no longer defines a DS3232RTC object,

Also wenns denn schonmal funktioniert hat, wäre meine quick and dirty Lösung ein downgrade auf die damals funktionierende lib Version.

Jup, danke dir, darauf bin ich nicht gekommen!
Bin ein Versionsjunkie und möchte immer die letzten Versionen haben :wink:

Bin auf eine ältere zurück und es scheint zu funktionieren !!

Dann wäre es doch jetzt der richtige Weg, diese beiden Sketche zu vergleichen.
Dann kannst du den Fehler sicher finden und daraus sehr viel lernen.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.