Hola, arme un programa para medir el peso de las personas en la luna y la tierra. Para esto use un "arduino uno compatible"; "sen-10245"; "Hx711"; "Display LCD Serial I2C 2x16".
El problema es que el cuando se inicia el programa muestra en el led: zero factor (valor x). ese valor tiene que dar -12 para que el programa funcione correctamente. pero el valor no es constante y no se como fijarlo.
Acá dejo el programa si lo quieren revisar.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "HX711.h"
#define DOUT 7
#define CLK 6
LiquidCrystal_I2C lcd(0x27,20,4);
HX711 scale(DOUT, CLK);
int luna=0;
float calibration_factor = 12000
void setup() {
//Serial.begin(9600);
lcd.init();
lcd.backlight();
// Serial.println("HX711 calibration sketch");
// Serial.println("Remove all weight from scale");
// Serial.println("After readings begin, place known weight on scale");
// Serial.println("Press + or a to increase calibration factor");
// Serial.println("Press - or z to decrease calibration factor");
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
lcd.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
lcd.println(zero_factor);
delay(2000);
lcd.clear();
lcd.setCursor(8,0);
lcd.print("IPM");
lcd.setCursor(4,1);
lcd.print("Listo");
delay(2000);
}
void loop() {
lcd.clear();
scale.set_scale(calibration_factor); //Adjust to this calibration factor
lcd.setCursor(0,0);
lcd.print("Tierra ");
lcd.setCursor(8,0);
lcd.print(scale.get_units(), 1);
lcd.setCursor(0,1);
lcd.print("Luna ");
lcd.setCursor(8,1);
luna= scale.get_units(), 1;
lcd.print((luna*1.6)/9.8);
//lcd.setCursor(0,1);
//lcd.print(" kg");
//Serial.print(" calibration_factor: ");
//lcd.print(calibration_factor);
// Serial.println();
if (Serial.available())
{
char temp = Serial.read();
if (temp == '+' || temp == 'a')
calibration_factor += 0.453592;
else if (temp == '-' || temp == 'z')
calibration_factor -= 0.453592;
}
delay(2000);
}
Si alguien se toma el tiempo de ayudarme gracias.