Enerlib with Arduino 1.0

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

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

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

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

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

Thanks

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.