Go Down

Topic: Enerlib with Arduino 1.0 (Read 903 times) previous topic - next topic

peterc12

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

robtillaart

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
Rob Tillaart

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

Coding Badly


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

• Locate and open Enerlib.cpp

• Change this line...

[font=Courier New]#include <wiring.h>[/font]

  ...to this...

[font=Courier New]#include <Arduino.h>[/font]

• Save and close Enerlib.cpp

• Try to compile

peterc12

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

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


Thanks

PaulS

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.

Go Up