Estoy haciendo un horno de medición de pt-100 y termocuplas tipo K, con una pantalla TFT de 4.3" y además con datalogger, pero tengo un problema con la termocupla.
Compre una interfaz MAX6675 de olimex, ya cargue la libreria max6675.h y estoy abriendo el ejemplo que trae la librería, y al verificar la correcta escritura en el programa me arroja el siguiente error:
no matching function for call to 'MAX6675::MAX6675(int&, int&, int&)'
In file included from olimexino_tc_serial.pde:4:
/Applications/Arduino.app/Contents/Resources/Java/libraries/MAX6675/max6675.h:9: error: expected `)' before 'SCLK'
/Applications/Arduino.app/Contents/Resources/Java/libraries/MAX6675/max6675.h:14: error: 'int8_t' does not name a type
/Applications/Arduino.app/Contents/Resources/Java/libraries/MAX6675/max6675.h:15: error: 'uint8_t' does not name a type
olimexino_tc_serial:11: error: no matching function for call to 'MAX6675::MAX6675(int&, int&, int&)'
/Applications/Arduino.app/Contents/Resources/Java/libraries/MAX6675/max6675.h:7: note: candidates are: MAX6675::MAX6675()
/Applications/Arduino.app/Contents/Resources/Java/libraries/MAX6675/max6675.h:7: note: MAX6675::MAX6675(const MAX6675&)
Este es el codigo que estoy usando (el ejemplo que viene con la librería)
#include "max6675.h"
//Pins for the Olimexino-328
int thermoDO = 12;
int thermoCS = 7;
int thermoCLK = 13;
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());
Serial.print("F = ");
Serial.println(thermocouple.readFarenheit());
delay(1000);
}
Alguna idea del porque me pasa esto? he leído que es por la versión del arduino, y descargue la 1.0 y tampoco me corre.
Gracias Surbyte, efectivamente, debí de tener alguna confusión con la librería, ahora me reconoce la librería, te lo agradezco... lo que si ahora me arroja un error de SerialUSB was not declares in this scope.
Traté de reemplazar Serial.USB.print por Serial.print y me arroja un error de compilación:
In file included from olimexinostm32_tc_serial.pde:4:
C:\Program Files (x86)\arduino-1.5.6-r2-windows\arduino-1.5.6-r2\libraries\MAX6675STM32/max6675.h:16: error: 'byte' does not name a type
Ahora no se si es problema de computador, porque utilizo un MAC y una maquina virtual de windows 7, en ambos realice la prueba, y me arroja el mismo resultado. Influye que utilice un MAC?
mira inserta este código y luego verifica el programa, aparecerá error de compilación, lo he hecho en 2 computadores y me aparece lo mismo
#include "max6675.h"
//Pins for the Olimexino-328
int thermoDO = 12;
int thermoCS = 7;
int thermoCLK = 13;
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());
Serial.print("F = ");
Serial.println(thermocouple.readFarenheit());
delay(1000);
}
D:/Dropbox/Arduino/Libraries/olimexinostm32_tc_serial/olimexinostm32_tc_serial.ino:15:3: error: 'SerialUSB' was not declared in this scope
pero fue cuando comenté #include "Arduino.h" porque ya había editado "Wprogram.h" aunque me sigue dando error como si estuviera. Muy raro!!!
Bueno encontré los problemas: Librería de la epoca de los dinosaurios.
Muchas cosas que hoy no se usan o cuyas librerías estas incorporadas al Arduino. Ejemplo byte, delay.h, etc.
Ajustando todo para que funcione.
// this example is public domain.
// www.ladyada.net/learn/sensors/thermocouple
#include <MAX6675.h>
//Pins for the Olimexino-stm32
int thermoDO = 12;
int thermoCS = 4;
int thermoCLK = 13;
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());
Serial.print("F = ");
Serial.println(thermocouple.readFarenheit());
delay(1000);
}
Librería MAX6675.h
// this library is public domain. enjoy!
// www.ladyada.net/learn/sensors/thermocouple
#include <Arduino.h>
//#include <inttypes.h>
class MAX6675 {
public:
MAX6675(int8_t SCLK, int8_t CS, int8_t MISO);
double readCelsius();
double readFarenheit();
private:
int8_t sclk, miso, cs;
byte spiread();
};
Librería MAX6675.cpp
// this library is public domain. enjoy!
// www.ladyada.net/learn/sensors/thermocouple
#include <Arduino.h>
//#include <inttypes.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);
delayMicroseconds(1000);
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::readFarenheit(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);
delayMicroseconds(1000);
if (digitalRead(miso)) {
//set the bit to 0 no matter what
d |= (1 << i);
}
digitalWrite(sclk, HIGH);
delayMicroseconds(1000);
}
return d;
}
IMPORTANTE: todos los archivos con mayúscula. Directorio, .h y .cpp todos MAX6675
saludos, voy a tener en cuenta este hilo, ya que de esto no se nada y voy por un proyecto similar esta semana, espero contar con la ayuda del grupo, ya pedi el modulo y el maz6675.