Pages: [1]   Go Down
Author Topic: Enerlib with Arduino 1.0  (Read 687 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Has anyone tried to compile the Enerlib Example code with Arduino 1.0?

I get this error report:

C:\Arduino\arduino-1.0\libraries\Enerlib\Enerlib.cpp:8:20: error: wiring.h: No such file or directory
C:\Arduino\arduino-1.0\libraries\Enerlib\Enerlib.cpp: In member function 'void Energy::PowerDown()':
C:\Arduino\arduino-1.0\libraries\Enerlib\Enerlib.cpp:24: error: 'delay' was not declared in this scope
C:\Arduino\arduino-1.0\libraries\Enerlib\Enerlib.cpp: In member function 'void Energy::Idle()':
C:\Arduino\arduino-1.0\libraries\Enerlib\Enerlib.cpp:34: error: 'delay' was not declared in this scope
C:\Arduino\arduino-1.0\libraries\Enerlib\Enerlib.cpp: In member function 'void Energy::SleepADC()':
C:\Arduino\arduino-1.0\libraries\Enerlib\Enerlib.cpp:44: error: 'delay' was not declared in this scope
C:\Arduino\arduino-1.0\libraries\Enerlib\Enerlib.cpp: In member function 'void Energy::PowerSave()':
C:\Arduino\arduino-1.0\libraries\Enerlib\Enerlib.cpp:54: error: 'delay' was not declared in this scope
C:\Arduino\arduino-1.0\libraries\Enerlib\Enerlib.cpp: In member function 'void Energy::Standby()':
C:\Arduino\arduino-1.0\libraries\Enerlib\Enerlib.cpp:64: error: 'delay' was not declared in this scope
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 169
Posts: 12448
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No,

Do you have a link to the library?

Probably it is not upgraded for use with 1.0, you should check the release notes of 1.0 to see what needs to be changed.

it should have something like this code in it.

#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Addendum to @robtillaart's post (he has the right idea; I just have more details)...

• Locate and open Enerlib.cpp

• Change this line...

#include <wiring.h>

  ...to this...

#include <Arduino.h>

• Save and close Enerlib.cpp

• Try to compile
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not sure what the difference between wiring.h and Wprogram.h is, but this did the trick:

Code:
#if defined(ARDUINO) && ARDUINO >= 100
  #include <arduino.h>
#else
  #include <wiring.h>
#endif

Thanks
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 549
Posts: 46073
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but this did the trick
That will work on a Windows system, where the OS thinks it is smarter than you. It will not work on a system that is smarter than Windows. (Which would be all the others.)

Refer back to Rob's post for why.

Hint: A != a.
Logged

Pages: [1]   Go Up
Jump to: