Very new to this. Just trying to compile the emonGLCD Home Energy Monitor sketch downloaded with EmonGLCD-master. I always get the following compile errors:
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\rtclib\RTClib.cpp: In static member function 'static uint8_t RTC_DS1388::EEPROMRead(uint16_t)':
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\rtclib\RTClib.cpp:368: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\Wire/Wire.h:58: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\Wire/Wire.h:56: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\rtclib\RTClib.cpp: In static member function 'static void RTC_DS1388::EEPROMReadPage(uint8_t, uint8_t*)':
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\rtclib\RTClib.cpp:407: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\Wire/Wire.h:58: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\Wire/Wire.h:56: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
Not sure what to do next. Any ideas?
Re: emonGLCD Home Energy Monitor sketch will not compile
When I look at my RTCLib, I haven't got 368 lines, and I've never seen that problem! It appears that Jean-Claude has added some real-time routines to his library and there's a conflict in there.
The Wire library function requestFrom is overloaded to accept either two parameters of uint8_t or two of int type. It seems RTClib is calling it with a uint8_t as the first, and a constant "1" or "8" as the second. I think the compiler is treating the constant as signed!
I'd try casting the constant to a uint8_t !
Or get an older copy of RTClib - I've attached the one I'm using, I suggest you try that.
Re: emonGLCD Home Energy Monitor sketch will not compile
Thanks for the reply. Unfortunately my coding skills are fairly basic so to try as you suggest will take me some time to work it out.
I tried your older copy of RTClib and the compiler errors change:
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp: In static member function 'static void RTC_DS1307::adjust(const DateTime&)':
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:125: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:126: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:127: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:128: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:129: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:130: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:131: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:132: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:133: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp: In static member function 'static DateTime RTC_DS1307::now()':
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:139: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:143: error: 'class TwoWire' has no member named 'receive'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:144: error: 'class TwoWire' has no member named 'receive'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:145: error: 'class TwoWire' has no member named 'receive'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:146: error: 'class TwoWire' has no member named 'receive'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:147: error: 'class TwoWire' has no member named 'receive'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:148: error: 'class TwoWire' has no member named 'receive'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:149: error: 'class TwoWire' has no member named 'receive'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp: In static member function 'static void RTC_PCF8563::adjust(const DateTime&)':
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:160: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:161: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:162: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:163: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:164: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:165: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:166: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:167: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:168: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:169: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:170: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:171: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:172: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:173: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:174: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:175: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp: In static member function 'static DateTime RTC_PCF8563::now()':
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:181: error: 'class TwoWire' has no member named 'send'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:185: error: 'class TwoWire' has no member named 'receive'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:186: error: 'class TwoWire' has no member named 'receive'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:187: error: 'class TwoWire' has no member named 'receive'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:188: error: 'class TwoWire' has no member named 'receive'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:189: error: 'class TwoWire' has no member named 'receive'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:190: error: 'class TwoWire' has no member named 'receive'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:191: error: 'class TwoWire' has no member named 'receive'
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp: In static member function 'static void RTC_Millis::adjust(const DateTime&)':
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:202: error: 'millis' was not declared in this scope
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp: In static member function 'static DateTime RTC_Millis::now()':
D:\My Documents\Personal\Open Energy Monitor\arduino-1.0.5\libraries\RTClib\RTClib.cpp:206: error: 'millis' was not declared in this scope
but I'm guessing from these different errors I maybe need some older versions of some other libraries or code.
Re: emonGLCD Home Energy Monitor sketch will not compile
Can you get a simple sketch to work, such as "blink.ino"?
Re: emonGLCD Home Energy Monitor sketch will not compile
Hmmm. I'm confused. I couldn't understand why you got that error last night, but it was late! I've got Arduino 1.0.5 too, I've just set up the 6-days old RTCLib and the Tester sketch has compiled error-free for me. But I get the same errors as you do for emonGLCD_HEM.ino
[Robin - it's a libraries issue! Specifically the Arduino Wire and JCW's RTCLib]
So what I've done:
In RTClib.cpp I changed line 368 to
Wire.requestFrom(getEEPROMBank(pos), 1U);
and line 407 to
Wire.requestFrom(getEEPROMBank((uint16_t)page * 8), 8U);
(In each case, 'U' is telling the compiler to treat the number (1 or 8) as unsigned rather than signed, and that keeps it happy.)
Re: emonGLCD Home Energy Monitor sketch will not compile
Thanks. That allowed to compile error free by changing the numbers 1 and 8 to unsigned numbers. Before the Tester sketch and the GLCD_SMM sketch compiled OK but not the HomeEnergyMonitor or SolarPV sketches. Now the HomeEnergyMonitor and SolarPV sketches compile and upload fine. Now I can start playing and try to learn a bit more about it all. Thanks for your help - much appreciated.