Arduino 1.0 issues

Greetings. I have been using Arduino for a few years now as a quick prototyping tool and LOVE it. I just recently upgraded from the 0022 to the 1.0 IDE because I just ordered a ProMicro board from sparkfun and need leonardo support. I was very interested to try the USB keyboard implementation that sparkfun has posted ( which utilized the Keyboard functions available in the new IDE. I have been working on some code in my 0022 IDE version and it works as expected with an infrared library that I downloaded (written for arduino). My goal was to use the IR code i developed in conjunction with the new keyboard functions available in IDE 1.0.
IE. Read IR code from remote control → send keyboard keystrokes to computer.

Here’s the problems. My code and the library worked perfectly in IDE version 0022 and i figured that i could simply load it in IDE version 1.0 (moving the IR library to the new library directory as well of course) and all would remain fine, then add the keyboard functionality I was after. I was wrong! I got all kinds of compile errors with the 0022 code… most of which are completely confusing to me as they are arduino functions!. Here are a few.

  1. C:\arduino-1.0\libraries\IRremote\IRremote.cpp:268: error: ‘digitalRead’ was not declared in this scope
  2. C:\arduino-1.0\libraries\IRremote\IRremote.cpp:254: error: ‘pinMode’ was not declared in this scope
  3. C:\arduino-1.0\libraries\IRremote\IRremote.cpp:254: error: ‘OUTPUT’ was not declared in this scope
  4. C:\arduino-1.0\libraries\IRremote\IRremote.cpp:201: error: ‘digitalWrite’ was not declared in this scope
  5. C:\arduino-1.0\libraries\IRremote\IRremote.cpp:261: error: ‘B00111001’ was not declared in this scope ← was solved by changing to 0x39…but why doenst it understand binary notation out of the box anymore?

I also was getting errors that members of a class were not defined because there were of data type uint8_t. I solved this by including <stdint.h> in the header file that used it…but i never had to do that in the older versions.

I feel like there is something really basic that I am doing incorrectly here or need to do to get external libraries and references to enumerated types to work again. I searched for these issues already but could not find others with the same problem… Maybe im not searching for the right thing? I thought you just include the new library’s in the library directory and the IDE references them when it loads up. Thats how it seemed to work before…

I appreciate the help everyone!

What was the first error message? You probably have to change an include of WProgram.h to include Arduino.h instead, where-ever you find it.

Wow. Fastest reply ever! Ok, WProgram.h was an include in one of the library headers. I changed it to Arduino.h and it compiled with out a problem! THANK YOU! So it this a base change in the 1.0 IDE? Wouldn't that make a great deal of sketches from older IDE's incomparable with new one or is this header file name change the only thing that needs to be changed?

Thanks again for the fast reply!

Yes, , it made a lot of stuff incompatible.

You can work around it with conditional defines, but it’s a pain.

A short tutorial I wrote about upgrading to arduino 1.0

A statement on a linked-to page:

… is incorrect:

Second, the write method requires types for constant arguments. You now need to specify the type for literal constant arguments to write. So, for example, change:




This compiles fine:

#include <Wire.h>

void setup ()
  Wire.begin ();
  Wire.beginTransmission (42);
  Wire.endTransmission ();

void loop () {}

It’s just write(0) that has a problem, eg:

#include <Wire.h>

void setup ()
  Wire.begin ();
  Wire.beginTransmission (42);
  Wire.endTransmission ();

void loop () {}

Personally I wouldn’t encourage people to have to stuff typecasts into function calls as routine. I think it’s a bad habit. My complaints about this in another thread have been ignored, basically.


That type cast on zero is necessary but not bad habit. If C++ had pointer constant post-fix, like long constant post-fix of 100000L, then you just need to do 0 for a byte constant and C++ would not consider it as a pointer constant (to zero address) because it lacks the pointer constant post-fix. You are right about that linked statement being wrong.


That type cast on zero is necessary but not bad habit. …

It’s only necessary because of the way the Arduino team did things in 1.0 for the write() function.
There is a really easy way to solve this in the TwoWire class so that it magically goes away.

Just add this to the public section of the TwoWire class in Wire.h

    inline size_t write(unsigned long n) { return write((uint8_t)n); }
    inline size_t write(long n) { return write((uint8_t)n); }
    inline size_t write(unsigned int n) { return write((uint8_t)n); }
    inline size_t write(int n) { return write((uint8_t)n); }

It is much easier than having to put casts all over the place.

— bill

Thank you everyone for your help. I feel much more prepared to start using the new IDE!