Ka07 RTC shield

Hi,
I bought the ka07 RTC shield but I don’t know if it works or not?
I have the DS1307RTC lib. I tried the SetTime project.
When I upload the program I get an error:

Arduino: 1.6.5 (Windows 8.1), Board:“Arduino Uno”

Build-opties gewijzigd, alles wordt opnieuw gebuild

ReadTest.ino:2:18: fatal error: Time.h: No such file or directory
compilation terminated.
Fout bij compileren.

Dit rapport zou meer informatie hebben met
“Tijdens de compilatie uitgebreide uitvoer weergeven”
ingeschakeld in Bestand > Voorkeuren.

What is wrong?

Tom

Could you post the sketch you are trying to compile?

#include <Wire.h>
#include <Time.h>
#include <DS1307RTC.h>

const char *monthName[12] = {
“Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”,
“Jul”, “Aug”, “Sep”, “Oct”, “Nov”, “Dec”
};

tmElements_t tm;

void setup() {
bool parse=false;
bool config=false;

// get the date and time the compiler was run
if (getDate(DATE) && getTime(TIME)) {
parse = true;
// and configure the RTC with this info
if (RTC.write™) {
config = true;
}
}

Serial.begin(9600);
while (!Serial) ; // wait for Arduino Serial Monitor
delay(200);
if (parse && config) {
Serial.print(“DS1307 configured Time=”);
Serial.print(TIME);
Serial.print(", Date=");
Serial.println(DATE);
} else if (parse) {
Serial.println(“DS1307 Communication Error :-{”);
Serial.println(“Please check your circuitry”);
} else {
Serial.print(“Could not parse info from the compiler, Time=”");
Serial.print(TIME);
Serial.print("", Date="");
Serial.print(DATE);
Serial.println(""");
}
}

void loop() {
}

bool getTime(const char *str)
{
int Hour, Min, Sec;

if (sscanf(str, “%d:%d:%d”, &Hour, &Min, &Sec) != 3) return false;
tm.Hour = Hour;
tm.Minute = Min;
tm.Second = Sec;
return true;
}

bool getDate(const char *str)
{
char Month[12];
int Day, Year;
uint8_t monthIndex;

if (sscanf(str, “%s %d %d”, Month, &Day, &Year) != 3) return false;
for (monthIndex = 0; monthIndex < 12; monthIndex++) {
if (strcmp(Month, monthName[monthIndex]) == 0) break;
}
if (monthIndex >= 12) return false;
tm.Day = Day;
tm.Month = monthIndex + 1;
tm.Year = CalendarYrToTm(Year);
return true;
}

A library and examples for the KA07 can be downloaded from our website:
velleman.eu/support/downloads/?code=KA07

Hi,

I just downloaded the library. But when I try the examples I get this error:

Arduino: 1.6.5 (Windows 8.1), Board:“Arduino Uno”

In file included from C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/WString.h:29:0,
from C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/Print.h:26,
from C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26,
from C:\Program Files\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:26,
from C:\Users\tom\Documents\Arduino\libraries\RTClib\RTClib.cpp:4:
C:\Users\tom\Documents\Arduino\libraries\RTClib\RTClib.cpp:17:31: error: variable ‘daysInMonth’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’
static uint8_t daysInMonth [] PROGMEM = { 31,28,31,30,31,30,31,31,30,31,30,31 };
^
Fout bij compileren.

Dit rapport zou meer informatie hebben met
“Tijdens de compilatie uitgebreide uitvoer weergeven”
ingeschakeld in Bestand > Voorkeuren.

Can you help me?

Tom

Yes i’ve noticed the error.
We’ll update the library as soon as possible.
What you now can do is open this file with a text editor
C:\Users\tom\Documents\Arduino\libraries\RTClib\RTClib.cpp
And change
static uint8_t daysInMonth [] PROGMEM = { 31,28,31,30,31,30,31,31,30,31,30,31 };
by
const uint8_t daysInMonth [] PROGMEM = { 31,28,31,30,31,30,31,31,30,31,30,31 };

Best Regards,
VEL337

We have updated the library, you can download the new version here:
KA07 RTC library

Hi,

Thanks for the help.
I changed

static uint8_t daysInMonth [] PROGMEM = { 31,28,31,30,31,30,31,31,30,31,30,31 };
by
const uint8_t daysInMonth [] PROGMEM = { 31,28,31,30,31,30,31,31,30,31,30,31 };
and now I can send the program to the Arduino.
But there is still something wrong.
In the serial monitor I receive strange characters.

Make sure the baudrate is correct in the serial terminal
as stated in the code Serial.begin(9600); so it should be 9600

Hi,

I downloaded the new lib and now it works.
The baudrate is now correct.
Now I can start.

Thanks for the support.

You’re welcome =)

happy coding :slight_smile:
VEL337