#include "HX711.h"
// #include "ssd1306.h"
// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = A1;
const int LOADCELL_SCK_PIN = A0;
HX711 load;
void setup()
{
Serial.begin(115200);
load.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
delay(250);
//load.tare(20); // Hacer 20 lecturas, el promedio es la tara
//load.set_scale(397); //La escala por defecto es 1
load.tare(-182600); // Hacer 20 lecturas, el promedio es la tara
load.set_scale(893);
}
void loop() {
// if (load.is_ready())
{
//long reading = load.read(); // Lectura sin tarar ni escalar
//long reading = load.get_value( ); // Valor leido menos tara, hacer 10 veces)
long reading = load.get_units(10); // Peso sin tara y corregido
Serial.println(reading );
}
//else
// Serial.println("HX711 not found.");
delay(500);
}
ssd1306_setFixedFont(ssd1306xled_font6x8);
ssd1306_clearScreen();
ssd1306_printFixed(0, 8, "Normal text", STYLE_NORMAL);
ssd1306_printFixed(0, 16, "Bold text", STYLE_BOLD);
ssd1306_printFixed(0, 24, "Italic text", STYLE_ITALIC);
ssd1306_negativeMode();
ssd1306_printFixed(0, 32, "Inverted bold", STYLE_BOLD);
ssd1306_positiveMode();
delay(3000);
Loading
xiao-esp32-c3
xiao-esp32-c3