How to use the hX711 load cell and MAX6675 thermocouple sensor in one code?

Hi,

I use an Arduino Due, and I want to measure the HX711 load cell and MAX6675 thermocouple together.

HX711 communicates through DOUT and CLK, and thermocouple uses SPI communication.

If I use the right library individually, it works fine, but the moment I make the two into one code, the temperature sensor stops at 26 degrees or doesn't work.
`

#include "HX711.h"
#define DOUT 4
#define CLK 5
#include "max6675.h"
int thermoDO = 74; //MISO - SDO; DO, DOUT, SO
int thermoCS = 52; //nCS, CS, CSB, CSN, nSS, STE
int thermoCLK = 76;

MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
HX711 scale;

float calibration_factor = -329; // this is my load cell Cal factor.
float Weight;

void setup() {
Serial.begin(115200);
scale.begin(DOUT, CLK);
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
}

void loop() {
Weight=scale.get_units();
Serial.print("Weight = ");
Serial.print(Weight);
Serial.print(", ");
Serial.print("C = ");
Serial.println(thermocouple.readCelsius());
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.