Smart Home Automation Forum

Full Version: A24 arduino demo source code-04-read K-type thermocouple by MAX31855
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
#include <my_max31855.h>
#include <arduino.h>
#include <EasyPCF8575.h>
#include "HardwareSerial.h"

EasyPCF8575 pcf8575_dev;
HardwareSerial my485Serial(2);
MY_MAX31855_Class mx31855_dev1;
MY_MAX31855_Class mx31855_dev2;
MY_MAX31855_Class mx31855_dev3;

int32_t result_value1 = 0;
int32_t result_value2 = 0;
int32_t result_value3 = 0;
void setup() {
 
  my485Serial.begin(38400,SERIAL_8N1,32,33);
  while(my485Serial.read()>0){}

  pcf8575_dev.startI2C(16,5,0x21);
 
  my485Serial.print("try Find8575:addr is ");
  my485Serial.print(pcf8575_dev.findPCFaddr(),HEX);

  mx31855_dev1.begin(1,12,14,false);  //1 is CH1
  mx31855_dev2.begin(2,12,14,false);  //2 is CH2
  mx31855_dev3.begin(3,12,14,false);  //3 is CH3

}

void loop() {
result_value1 = mx31855_dev1.readProbe();
result_value2 = mx31855_dev2.readProbe();
result_value3 = mx31855_dev3.readProbe();
my485Serial.printf("current1 temp:%d C||current2 temp:%d C||current3 temp:%d C\n",result_value1/1000,result_value2/1000,result_value3/1000);
delay(1000);
}
Install  easypcf8575  library
[attachment=3667]
Unzip max31855.zip file and copy the file to arduino librarys 
[attachment=3668]
[attachment=3669]