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

DIY Robocars via Twitter
Videos from the ICRA autonomous racing workshop are now available: https://linklab-uva.github.io/icra-autonomous-racing/
Thursday
DIY Robocars via Twitter
RT @SmallpixelCar: Prepared race track for Warm Spring Raceways @wsraceways and looking forward to test my new car at RAMS RC @ramsaicar fa…
Jun 6
DIY Robocars via Twitter
RT @f1tenth: Trying out some nasty blocking maneuvers 🏎️🤖 #f1tenth #autonomousracing https://t.co/nMTstsaogM
Jun 5
DIY Robocars via Twitter
May 27
DIY Robocars via Twitter
RT @araffin2: I will talk this Saturday from 18:00 to 19:00 Paris time for the @diyrobocars community about learning to race in hours using…
May 27
DIY Robocars via Twitter
RT @a1k0n: Luckily the infeasible hairpin problem was easily reproducible in simulation and I could test the fix before bringing the car ba…
May 26
DIY Robocars via Twitter
RT @a1k0n: Another problem was that I was over-constraining the car's allowed accelerations, so it didn't think it could turn as tight as i…
May 26
DIY Robocars via Twitter
RT @a1k0n: Breaking the map up into two halves worked, but I had to be more careful about separating the inner track from outer. There's se…
May 26
DIY Robocars via Twitter
RT @a1k0n: Here's a datalog for my fastest lap of the day. Lap timer is tiny window lower-left. https://t.co/myrlWWrKUY
May 26
DIY Robocars via Twitter
May 26
DIY Robocars via Twitter
RT @a1k0n: Here was my car's POV. Man this track is confusing in first-person! After the incident my camera was all scuffed up and I was af…
May 23
DIY Robocars via Twitter
RT @circuitlaunch: Loved seeing so many familiar (masked) faces at Circuit Launch today for our first in person @diyrobocars in over a year…
May 22
DIY Robocars via Twitter
RT @circuitlaunch: Last but not least, mystery guest @BostonDynamics Spot took to the track @diyrobocars He enjoyed the #brazilianbbq too 😂…
May 22
DIY Robocars via Twitter
RT @SmallpixelCar: Today’s race @circuitlaunch for @diyrobocars with @a1k0n Was busy in the morning and did not get a chance to tune camera…
May 22
DIY Robocars via Twitter
RT @a1k0n: This was epic. My car was barely working this morning, had to make a lot of changes and extremely dirty hacks. Post-race analysi…
May 22
DIY Robocars via Twitter
DIY Robocars @ Circuit Launch, 3/7/2020 https://twitch.tv/diyrobocars
May 22
More…