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
MAX31855 Library on Arduino Due
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Franklin97355
- Posts: 23912
- Joined: Mon Apr 21, 2008 2:33 pm
Re: MAX31855 Library on Arduino Due
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.
-
- Posts: 3
- Joined: Sun May 26, 2013 6:08 pm
Re: MAX31855 Library on Arduino Due
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
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
-
- Posts: 1
- Joined: Tue Apr 01, 2014 9:06 am
Re: MAX31855 Library on Arduino Due
I've got the same problem.
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: MAX31855 Library on Arduino Due
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.
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.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: MAX31855 Library on Arduino Due
Change the #include section of Adafruit_MAX31855.cpp to look like this:
Please let me know if it works - I will check the changes into github if it does.
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>
- WKDLabs
- Posts: 18
- Joined: Mon Jan 06, 2014 1:05 pm
Re: MAX31855 Library on Arduino Due
thanks, that worked for me on RFduino and for your TCS34725 library
- harbo
- Posts: 1
- Joined: Sun Apr 26, 2015 7:18 am
Re: MAX31855 Library on Arduino Due
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>
#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>
Please be positive and constructive with your questions and comments.