MAX6675 with Due

Hello, I'm using Type K thermocouple and it was working with Uno, now I'm trying the same code with same library with Due and I get the following error:

Arduino: 1.6.8 (Windows 10), Board: "Arduino Due (Programming Port)"

C:\Program Files (x86)\Arduino\libraries\max6675\max6675.cpp:9:24: fatal error: util/delay.h: No such file or directory

#include <util/delay.h>

^

compilation terminated.

exit status 1
Error compiling for board Arduino Due (Programming Port).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

#include "max6675.h"

int thermoDO = 5;   // SO
int thermoCS = 6;   // CS
int thermoCLK = 7;  // SCK

MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);

  
void setup() {
  Serial.begin(9600);

  
  Serial.println("MAX6675 test");
  // wait for MAX chip to stabilize
  delay(500);
}

void loop() {
  // basic readout test, just print the current temp
  
   Serial.print("C = "); 
   Serial.println(thermocouple.readCelsius());
   
 
   delay(3000);
}

Attached is MAX6675-library-master that I'm using

Your help is appreciated :smiley:

MAX6675-library-master.zip (3.98 KB)

Hi,
I have the same problem. How did you solved it?
Thank you

Remove util/delay.h from the library, this is for an AVR but your board is an ARM.

https://forum.arduino.cc/index.php?topic=19963.0

[// this library is public domain. enjoy!
// www.ladyada.net/learn/sensors/thermocouple

#include <avr/pgmspace.h>

#include <stdlib.h>
#include "max6675.h"

MAX6675::MAX6675(int8_t SCLK, int8_t CS, int8_t MISO) {
  sclk = SCLK;
  cs = CS;
  miso = MISO;

  //define pin modes
  pinMode(cs, OUTPUT);
  pinMode(sclk, OUTPUT); 
  pinMode(miso, INPUT);

  digitalWrite(cs, HIGH);
}
double MAX6675::readCelsius(void) {

  uint16_t v;

  digitalWrite(cs, LOW);
  v = spiread();
  v <<= 8;
  v |= spiread();

  digitalWrite(cs, HIGH);

  if (v & 0x4) {
    // uh oh, no thermocouple attached!
    return NAN; 
    //return -100;
  }

  v >>= 3;

  return v*0.25;
}

double MAX6675::readFahrenheit(void) {
  return readCelsius() * 9.0/5.0 + 32;
}

byte MAX6675::spiread(void) { 
  int i;
  byte d = 0;

  for (i=7; i>=0; i--)
  {
    digitalWrite(sclk, LOW);
 
    if (digitalRead(miso)) {
      //set the bit to 0 no matter what
      d |= (1 << i);
    }

    digitalWrite(sclk, HIGH);
  }

  return d;
}]

aun que sigue diciendo avr a mi me a funcionado en placas amr en especial stm32fi03c8t6 pero se que también funciona en DUE habres tu libreria cpp cortas lo que contiene lo pegas en un block de notas y pega este e intenta cargar lo yo lo edito con notapad++ pero también debe funcionar cortando y pegando me gustaria saber si te funciono riegosnaturales@gmail.com