MAX31855 Library on Arduino Due
Moderators: adafruit_support_bill, adafruit

MAX31855 Library on Arduino Due

by crossi on Sun May 26, 2013 6:15 pm

As I am going through Adafruit thermocouple tutorial, I downloaded the MAX31855 library for use with an Arduino Due and the got following compile error:

Adafruit_MAX31855.cpp:18: fatal error: avr/pgmspace.h: No such file or directory

Commenting out that lines shows it also cannot find util/delay.h

I understand from other posts that some libraries are not supported for Due yet. Is there a workaround to get this chip working with a Due? Is there a way to add it to the include path?

Thanks
crossi
 
Posts: 3
Joined: Sun May 26, 2013 6:08 pm

Re: MAX31855 Library on Arduino Due

by franklin97355 on Sun May 26, 2013 7:32 pm

Make sure you have the library installed in the correct place, this can give you that error. The library may not be updated but check the location anyway.
User avatar
franklin97355
 
Posts: 6201
Joined: Mon Apr 21, 2008 2:33 pm

Re: MAX31855 Library on Arduino Due

by crossi on Sun May 26, 2013 9:26 pm

Yes it appears to be in a correct location: <mySketchDir>/libraries/MAX31855/

I also tried adding it to the location of the built in libraries in <myLoc>/arduino-1.5.2/libraries/MAX31855/ and got the same error.

It does show up in the Sketch-> Import Library menu
crossi
 
Posts: 3
Joined: Sun May 26, 2013 6:08 pm

Re: MAX31855 Library on Arduino Due

by edusidsan on Sun Apr 20, 2014 10:07 am

I've got the same problem.
edusidsan
 
Posts: 1
Joined: Tue Apr 01, 2014 9:06 am

Re: MAX31855 Library on Arduino Due

by adafruit_support_mike on Tue Apr 22, 2014 2:37 pm

In general terms, that's a hardware compatibility issue.

The file "avr/pgmspace.h" contains information about the ATmega series of microcontrollers, which are used in the Uno and other main-line Arduinos. The Due uses an ARM chip, so information about the AVR memory space isn't relevant there.

I'm not sure exactly what job that header has in the MAX31855 library, so I'll pass this to our Due expert to see if he has any suggestions.
User avatar
adafruit_support_mike
 
Posts: 11337
Joined: Thu Feb 11, 2010 2:51 pm

Re: MAX31855 Library on Arduino Due

by adafruit_support_rick on Wed Apr 23, 2014 10:04 am

Change the #include section of Adafruit_MAX31855.cpp to look like this:
Code: Select all | TOGGLE FULL SIZE
#include "Adafruit_MAX31855.h"
#ifdef __avr__
  #include <avr/pgmspace.h>
  #include <util/delay.h>
#endif
#ifdef __arm__
    #define _delay_ms(ms) delayMicroseconds((ms) * 1000)
#endif
#include <stdlib.h>


Please let me know if it works - I will check the changes into github if it does.

adafruit_support_rick
 
Posts: 14496
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY