How to make a coding using 3 load cells to weight 3 different load?

my bad guys. thank you for helping me. have a great day. sorry for the unspecific questions

Before you got to that mass of code, you had a much simpler one that just read the load cells.

Post that one.

Please remember to use code tags when posting code

so here the coding to read the load cell, but only for one load cell:

#include <HX711_ADC.h>
#if defined(ESP8266)|| defined(ESP32) || defined(AVR)
#include <EEPROM.h>
#endif

//pins:
const int HX711_dout = 2; //mcu > HX711 dout pin
const int HX711_sck = 3; //mcu > HX711 sck pin

//HX711 constructor:
HX711_ADC LoadCell(HX711_dout, HX711_sck);

const int calVal_eepromAdress = 0;
unsigned long t = 0;

void setup() {
Serial.begin(57600); delay(10);
Serial.println();
Serial.println("Starting...");

LoadCell.begin();
float calibrationValue; // calibration value (see example file "Calibration.ino")
calibrationValue = -38.57; // uncomment this if you want to set the calibration value in the sketch
#if defined(ESP8266)|| defined(ESP32)
//EEPROM.begin(512); // uncomment this if you use ESP8266/ESP32 and want to fetch the calibration value from eeprom
#endif
//EEPROM.get(calVal_eepromAdress, calibrationValue); // uncomment this if you want to fetch the calibration value from eeprom

unsigned long stabilizingtime = 2000; // preciscion right after power-up can be improved by adding a few seconds of stabilizing time
boolean _tare = true; //set this to false if you don't want tare to be performed in the next step
LoadCell.start(stabilizingtime, _tare);
if (LoadCell.getTareTimeoutFlag()) {
Serial.println("Timeout, check MCU>HX711 wiring and pin designations");
while (1);
}
else {
LoadCell.setCalFactor(calibrationValue); // set calibration value (float)
Serial.println("Startup is complete");
}
}

void loop() {
static boolean newDataReady = 0;
const int serialPrintInterval = 0; //increase value to slow down serial print activity

// check for new data/start next conversion:
if (LoadCell.update()) newDataReady = true;

// get smoothed value from the dataset:
if (newDataReady) {
if (millis() > t + serialPrintInterval) {
float g1 = LoadCell.getData();
Serial.print("Load_cell output val: ");
Serial.println(g1);
newDataReady = 0;
t = millis();
}
}

// receive command from serial terminal, send 't' to initiate tare operation:
if (Serial.available() > 0) {
char inByte = Serial.read();
if (inByte == 't') LoadCell.tareNoDelay();
}

// check if last tare operation is complete:
if (LoadCell.getTareStatus() == true) {
Serial.println("Tare complete");
}

}

@anon73444976

Could you please post with code tags and formatted? Also, does your code with one load cell work?

Also, remember that you are asking people to help you who likely do not have access to your hardware and therefore are debugging you code by inspection. You need to be very specific about what the program is doing or not doing rather than just "none of the load cells are working".

Please assure us that this will never be deployed for the actual protection of actual living things that have actually been left in a car to die.

Please. These are hobby/enthusiast fora. Development of a system to reduce deaths would be a major undertaking. Which Imma guess you aren’t up to, even if you are up for it.

a7

I hope this is a school project...

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