Smart Home Automation Forum
A24 arduino demo source code-04-read K-type thermocouple by MAX31855 - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KinCony A24 (https://www.kincony.com/forum/forumdisplay.php?fid=56)
+--- Thread: A24 arduino demo source code-04-read K-type thermocouple by MAX31855 (/showthread.php?tid=3795)



A24 arduino demo source code-04-read K-type thermocouple by MAX31855 - KinCony Support - 12-07-2023

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
   
Unzip max31855.zip file and copy the file to arduino librarys 

.zip   MAX31855.zip (Size: 4.54 KB / Downloads: 108)