Setting the time on a Stalker v2.3 with the RTC DS3231 chip


I’m new to the Stalker and have trouble setting the time. I think the fact that some of the code I downloaded and the Arduino IDE isn’t compatible with each other. I had tried almost every thing and is now hoping someone could help me out of my misery.

I have the Stalker 2.3v with the DS3231 RTC chip and running the Arduino 1.0.1 on a mac with Lion. My aim is to get the board to have the correct time set and then have an alarm or 2 to turn a servo twice a day.

This is a repost of a reply I made to someone else. Basically, you have to change the DS3231.cpp and DS3231.h file.

There have been changes to the base arduino libraries.

First, in any .cpp file that includes WProgram.h, change:

#include <WProgram.h>


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

Second, Wire.h has changed, as per this excerpt from the Arduino documentation:

“As of Arduino 1.0, the library inherits from the Stream functions, making it consistent with other read/write libraries. Because of this, send() and receive() have been replaced with read() and write().”

So far, I have had to do a search and replace when I run across those. I do not yet have any good cpp magic going.