#include "HX711.h"
const int LOADCELL_DOUT_PIN = 32;
const int LOADCELL_SCK_PIN = 33;
HX711 scale;
float calibration_factor = 1; // 根据实际传感器校准
void setup() {
Serial.begin(115200);
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
scale.set_scale(calibration_factor);
scale.tare();
Serial.println("HX711称重传感器初始化完成");
}
void loop() {
float weight = scale.get_units(5);
Serial.printf("重量: %.2f kg\n", weight);
delay(500);
}