Pages: [1] 2   Go Down
Author Topic: Getting error with RTCdue lib  (Read 848 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 106
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, i'm getting this error:

 "In file included from TESTE_AJAX_COMPLETO_2.ino:8:
D:\Transferências\arduino-1.0.3\libraries\RTCdue/RTCdue.h:49: error: 'PIN_WIRE_SDA' was not declared in this scope
D:\Transferências\arduino-1.0.3\libraries\RTCdue/RTCdue.h:49: error: 'PIN_WIRE_SCL' was not declared in this scope

I've run the library examples and i get the same error.
I can't find anything related to this.
Thanks in advance!
« Last Edit: April 15, 2013, 11:32:39 am by blastboot » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 615
Posts: 49388
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My version 1.0.3 of the Arduino IDE did not come with an RTCdue library. Nor did my 1.0.4 version. I'm surprised that yours did.

If it didn't, and you downloaded that library, you put it in the wrong place. And, you didn't tell us where you got it.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 106
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My version didn't came with it too  smiley-wink
I downloaded from https://github.com/oskarirauta/RTCdue

I was trying to use this library because i've read that wire.h lib may cause some troubles with sd card, and this rtcdue says that it doesn't need wire library.

Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 615
Posts: 49388
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Which Arduino are you compiling for?

Quote
D:\Transferências\arduino-1.0.3
says it isn't the DUE.

https://github.com/oskarirauta/RTCdue
says:
Quote
DS1307 library for DUE that doesn't need wire.h. Should work on others as well, just make sure you initialize with sda and scl pins if you cannot get it to work..

The error messages indicate that you did not do this.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 106
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm compiling for arduino uno. I look at that too but i could't find how to do that.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 615
Posts: 49388
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but i could't find how to do that.
Simplest way is to edit the header file for the class and change those two names for the actual pin numbers (A4 and A5).
Logged

Mid-Atlantic, USA
Offline Offline
God Member
*****
Karma: 30
Posts: 515
"Remember kids, the only difference between Science and screwing around is writing it down." - Adam Savage
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From the RTCdue.cpp file on git I see
Code:
RTC_DS1307::RTC_DS1307(const uint8_t data_pin, const uint8_t sclk_pin) {
  _sda_pin = data_pin;
  _scl_pin = sclk_pin;
  pinMode(_scl_pin, OUTPUT);
}

That tells me when you initialize the class instead of leaving the parentheses empty (or at the values in the examples), provide two pin numbers for the sda and scl pins. So, on the UNO you would probably want
Code:
// Init the DS1307
DS1307 rtc(A4, A5);

Edit: clarified my suggestion
« Last Edit: April 15, 2013, 04:36:47 pm by Sembazuru » Logged


Mid-Atlantic, USA
Offline Offline
God Member
*****
Karma: 30
Posts: 515
"Remember kids, the only difference between Science and screwing around is writing it down." - Adam Savage
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I also forgot to mention... For best practices, you should probably should have installed the RTCdue library into your <sketches>\libraries folder instead of in the IDE libraries folder (and your sketches folder shouldn't be in the IDE folder tree). That way when you upgrade your IDE you don't have the accidental possibility of loosing access to the library.
Logged


Offline Offline
Full Member
***
Karma: 0
Posts: 106
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you very much, i've already done what PaulS mention and changed it on header of RTCdue.h file.
Good to know that it can be made that way which is good to change pins whenever we want.

Somethimes i asked myself "I have to change everything everytime that i update arduino IDE?"
of couse after your post i got my answer!
Many thanks to you all, you were very helpful!  smiley-wink
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 106
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sembazuru I've tested this:  RTC_DS1307 rtc (A4, A5);  //A4 = SDA --- A5 = SCL
but it keeps giving me the same error:  error: 'PIN_WIRE_SDA' was not declared in this scope
                                                         error: 'PIN_WIRE_SCL' was not declared in this scope
Logged

Mid-Atlantic, USA
Offline Offline
God Member
*****
Karma: 30
Posts: 515
"Remember kids, the only difference between Science and screwing around is writing it down." - Adam Savage
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You have a space between "rtc" and "("... I'm not sure if this is allowed. (Not the way I normally write, but that might just be a style issue, not a syntax issue.)
Logged


Offline Offline
Full Member
***
Karma: 0
Posts: 106
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Still doesn't work... but as you said it must be working as it says here:

// RTC based on the DS1307 chip connected via I2C and the Wire library
class RTC_DS1307 {
public:
  RTC_DS1307(const uint8_t data_pin = PIN_WIRE_SDA, const uint8_t sclk_pin = PIN_WIRE_SCL);
  void begin(void);
  void adjust(const DateTime& dt);
  uint8_t isrunning(void);
  DateTime now(void);
private:
  uint8_t _scl_pin;
  uint8_t _sda_pin;
  uint8_t _burstArray[8];

« Last Edit: April 15, 2013, 05:26:37 pm by blastboot » Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 106
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

doing this:   RTC_DS1307(A4, A5);  //A4 = SDA --- A5 = SCL

It gives another error:   error: 'rtc' was not declared in this scope
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 615
Posts: 49388
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but it keeps giving me the same error:  error: 'PIN_WIRE_SDA' was not declared in this scope
                                                         error: 'PIN_WIRE_SCL' was not declared in this scope
Not surprising, as those constants are still (not) defined in the header file.

Quote
doing this:   RTC_DS1307(A4, A5);  //A4 = SDA --- A5 = SCL

It gives another error:   error: 'rtc' was not declared in this scope
Enough of the guessing games. Post YOUR code.
Logged

MN,US
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi I am wondering if you ever find a solution to your problem.
I seems to be having similar issues.
I am using Arduino Due and using DS1307 kit from Adafruit.com
I hook it up per instruction but I use the DS1307 example I got from RTCdue.h github.
When I read the serial monitor, I got

RTC is NOT running!
85.85.2085 85:85:85
 since midnight 1/1/1970 = 4162890385s = 48181d
 now + 7d + 30s: 26.10.2101 14:26:55

pretty much the date and time are wrong.

I did try this DS1307 kit on an Uno using RTClib.h and it works fine there.

I also use logic level shifter from Sparkfun to convert the 5V I2C signals into 3.3V I2C signals.

Any clue on what is wrong and what I should be looking at?

I also tried changing the code to have
RTC_DS1397 rtc(20,21); and it compiles and loads fine but the time and date are still wrong.


Could the SCL and SDA pin be bad on my board yet the board can still have power and loaded and do serial monitoring?
I measured the voltages on those 2 pins without anything connected to them and read 3.3V. Is this okay?


Thanks.
Logged

Pages: [1] 2   Go Up
Jump to: