Compiling ArduIMU sketch with Arduino 1.0.3

Anyone who uses ArduIMU and tried to upgrade Arduino from 0022 to the current version (anything past 1.0)  discovered that good old firmware that was compiling just fine in the previous versions now throws all kinds of errors.  After doing a quick search on the forum you discover that the official version is that "we don't support V1.0" for the IMU.  Anyhow, just like many others here I just went back to the good old 0022 and forgot about that issue for a while.  Until recently.  I needed to check TX buffer of my UART if it is empty or not.  Turns out there is no such functionality in 0022 but in 1.0 and later Serial.flush() does just that.  So I was back to the same problem - trying to compile my sketch on 1.0

Long story short, it seems to work now.  I haven't had a chance to test the software yet but at least it compiled.

Here are the steps:

1. Install the new Arduino (Current version 1.0.3)

2  Copy old library folders from old Arduino install folder to the new one.  The libraries you are going to need are AP_GPS, AP_Math, AP_Compass and FastSerial. 

3.  Open Arduino 1.0 (or restart it if you already had it opened) and open your ArduIMU sketch.  You should see these libraries in the list of libraries used by Arduino.

4.  Go to the HMC5883 tab and replace all instances of Wire.send to Wire.write and Wire.receive to Wire.read

5.Go to your FastSerial folder (the one you copied to the Arduino library folder.  Open file FastSerial.h in your favorite text editor and change the line virtual void write(unit8_t c); to virtual size_t write(unit8_t c);  Save the file

6. Open FastSerial.cpp and change void FastSerial::Write(unit8_t c) to size_t FastSerial::Write(unit8_t c)  A couple of lines below in the same function change return; to return 0; and at the bottom of the function right before the bracket add return i;

7. In the same file (FastSerial.cpp) go back to the top and change #include "WProgram.h" to #include "Arduino.h"    Save the file and close.  Now go through all the library folders which you added (AP_GPS, AP_Math, AP_Compass)  Open every *.cpp file in every folder and do the same thing (change WProgram.h to Arduino.h) with the exception of APM_Compass.cpp

8.  Open APM_Compass.cpp  delete #include "WProgram.h" and add #include "Arduino.h" before  extern "C" {

9. Now parse through the text of the file (APM_Compass.cpp) and repeat step 4 (find and replace all instances  of Wire.send to Wire.write and Wire.receive to Wire.read

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • I went back and replaced "Arduino.h" with <Arduino.h> and it compiles.  Thanks for posting the solution to FastSerial.h

  • Can you tell me at what rate are you getting your readings?

This reply was deleted.

Activity