MAX31855 Library on Arduino Due

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
crossi
 
Posts: 3
Joined: Sun May 26, 2013 6:08 pm

MAX31855 Library on Arduino Due

Post by crossi »

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

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: MAX31855 Library on Arduino Due

Post by Franklin97355 »

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.

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

Re: MAX31855 Library on Arduino Due

Post by crossi »

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

edusidsan
 
Posts: 1
Joined: Tue Apr 01, 2014 9:06 am

Re: MAX31855 Library on Arduino Due

Post by edusidsan »

I've got the same problem.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: MAX31855 Library on Arduino Due

Post by adafruit_support_mike »

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_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: MAX31855 Library on Arduino Due

Post by adafruit_support_rick »

Change the #include section of Adafruit_MAX31855.cpp to look like this:

Code: Select all

#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.

User avatar
WKDLabs
 
Posts: 18
Joined: Mon Jan 06, 2014 1:05 pm

Re: MAX31855 Library on Arduino Due

Post by WKDLabs »

thanks, that worked for me on RFduino and for your TCS34725 library

User avatar
harbo
 
Posts: 1
Joined: Sun Apr 26, 2015 7:18 am

Re: MAX31855 Library on Arduino Due

Post by harbo »

The same is valid for the ESP8266 module this is the change I made :

#include "Adafruit_MAX31855.h"
#ifdef __AVR
#include <avr/pgmspace.h>
#elif defined(ESP8266)
#include <pgmspace.h>
#endif
#define _delay_ms(ms) delayMicroseconds((ms) * 1000)
#include <stdlib.h>
#include <SPI.h>

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”