Help with DS 2324 RTC (SPI device)

I have a new DS3234 DeadOn RTC board that I'm learning to use. One of the most helpful pieces is from Marc Lane's page on the device: Arduino DeadOn RTC – DS3234 wiring example and tutorial. – Marc Lane's Blog . It has two applications. The first is a Sparkfun sketch that worked as advertised on my 2560 Mega when I connect to the Mega SPI pins (50, 51 and 52 but not 53 which can be re-assigned).

The second sketch is from an example within Maciacbug's GitHub page and is within the 3234 library: GitHub - maniacbug/RTClib: A fork of Jeelab's fantastic RTC library . That is where I run into issues. When I attempt to compile it in the 1.6.10 IDE I get a compilation error:

Arduino: 1.6.10 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\Victor-Hallie\Documents\Arduino\libraries\ManicbugRTCLib\RTC_DS1307.cpp:5:22: fatal error: WProgram.h: No such file or directory

#include <WProgram.h>

^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

The example code is old, and I had to change the file type to "ino" from PDE. Can someone suggest a fix? What should I remove, and what should I put into its place? (Note, there are obviously some comment errors. I haven't altered them.)

Sketch copied and attached.

Thank you in advance,

Vic

ds3234.ino (1.48 KB)

Wh en you see

#include <WProgram.h>

Then yes il is old (and I would not use it unless I read it and fully understand it)

Try changing the WProgram.h to Arduino.h

A little more information:

Here is what I'm seeing within library structure (please see attachment). There are 4 libraries listed, and three have #Include WProgram.h: RTC_DS3234.cpp, RTC_DS3234.h, and RTClib.CPP. I don't see Wprogram.h in the RTC.h library.

A posting on GitHub for 2014 for RTC_3234 has both #include Wprogrma.h and #include Arduino.h:

// Code by JeeLabs http://news.jeelabs.org/code/
// Released to the public domain! Enjoy!

#if ARDUINO < 100
#include <WProgram.h>
#else
#include <Arduino.h>
#endif

#include <avr/pgmspace.h>
#include <SPI.h>
#include "RTClib.h"
#include "RTC_DS3234.h"

What is happening with the IF statement above?

I'm guessing that I'm using obsolete library versions. What is the strategy for finding library versions suitable for the current IDE? What was the changeover date?

Again, Thank you. Vic

I'm guess

libraries.PNG

#if ARDUINO < 100
#include <WProgram.h>
#else
#include <Arduino.h>
#endif

That says if you use the Arduino IDE version before 100 then include WProgram otherwise if you have a more recent IDE use then include Arduino.h (which is your case with version 1.6.1)

So libraries that have this piece of code are more recent and know about the changes that happened back at version 1

You can also check that simple library

What you're seeing is the main #include to get the Arduino core. Back before 1.0 it was called WProgram.h When they came out with Arduino 1.0 they changed that file a lot and renamed it to Arduino.h. Any library that wants to use any of the core functions, stuff like digitalRead or digitalWrite, should include Arduino.h.

Thank you, DeltaG.

Then it appears that I should go into the various libraries within the Zip file I downloaded from Manicbug's GitHub page and change every instance of [old] to [new]. That is likely to return the original functionality, right?

It seems a little klugy, but it could work. I'm bothered by the fact that I'm a newby, and there are libraries calling other libraries.

But what the heck!

Thank you again,

Vic

Here is the windup: I was interested in exploring the DS3224 RTC that is easily obtained from SparkFun and others as the DeadOn RTC. It seemed well explained by Marc Lane, but I was not successful in getting his copy of the software to compile (2nd example). He referenced Maniacbug. (Note: both have posted within this forum.)

Marc Lane's second example is the example sketch in Maniacbug's library. It is intended to read the clock display time via the serial monitor.

This software library from Maniacbug on GitHub does compile. I used the example within the download, and I changed to extension from PDE to INO.

At this point I don't know if the software works, but only that it does compile. "Works" is for further exploration.

Thank you to all who commented and read my posting.

Have you checked the one I mentioned in my post above?

J-M-L, Yes. And thank you for the explanation and suggestions. Sorry for not being explicit.

I did substitute #include Arduino instead, but there appeared to be other compiler issues in the code set Marc Lane had in his blog. Rather than attempt to debug the code, I looked hard at Maniacbug's, which included the IF statement that switches in #include Arduino for versions of the IDE >=100. That was in one of the many associated libraries. Maniacbug's entire set of code that compiled cleanly.

Just to note, there are a number of DS3234 implementations within Github, and a number of these have library names that are the same at Maniacbug's. I've not investigated these to determine what the differences are. There is also at least one commercial product with publicly-available creative commons software on the internet, and it has clearly written documentation. I haven't fully investigated it except for quickly reading the documentation and browsing the code.

I like the objectives of Maniacbug's example, and I also like the objectives of the examples in the Rinky-Dink implementation.

Again, thank you to all who have shown interest.

Vic