Hey Arduino guys and girls,
I have a question regarding coding due to the Load Cell Amplifier HX711.
The code which I downloaded here:
https://learn.sparkfun.com/tutorials/load-cell-amplifier-hx711-breakout-hookup-guide
Library: https://github.com/bogde/HX711
works fine. Here the example code which I already adapt to my loadcell:
/*
Example using the SparkFun HX711 breakout board with a scale
By: Nathan Seidle
SparkFun Electronics
Date: November 19th, 2014
License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
Most scales require that there be no weight on the scale during power on. This sketch shows how to pre-load tare values
so that you don't have to clear the scale between power cycles. This is good if you have something on the scale
all the time and need to reset the Arduino and not need to tare the scale.
This example code uses bogde's excellent library: https://github.com/bogde/HX711
bogde's library is released under a GNU GENERAL PUBLIC LICENSE
The HX711 does one thing well: read load cells. The breakout board is compatible with any wheat-stone bridge
based load cell which should allow a user to measure everything from a few grams to tens of tons.
Arduino pin 2 -> HX711 CLK
3 -> DOUT
5V -> VCC
GND -> GND
The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.
*/
#include "HX711.h"
#define calibration_factor 4390.0 //This value is obtained using the SparkFun_HX711_Calibration sketch
#define zero_factor 18230 //This large value is obtained using the SparkFun_HX711_Calibration sketch
#define DOUTÂ 3
#define CLKÂ 2
HX711 scale(DOUT, CLK);
void setup() {
 Serial.begin(9600);
 Serial.println("Demo of zeroing out a scale from a known value");
 scale.set_scale(calibration_factor); //This value is obtained by using the SparkFun_HX711_Calibration sketch
 scale.set_offset(zero_factor); //Zero out the scale using a previously known zero_factor
 Serial.println("Readings:");
}
void loop() {
 Serial.print("Reading: ");
 Serial.print(scale.get_units(), 1); //scale.get_units() returns a float
 Serial.print(" kg"); //You can change to lbs but you'll need to change the calibration_factor
 Serial.println();
}
Now I want to switch on a LED if the sensor reaches a certain value.
like here:
https://www.youtube.com/watch?v=SH_aOOj-ork
For example:
If the weight is greater than 1kg put the LED on.
Extraction of example code:
// if the analog value is high enough, turn on the LED:
 if (analogValue > threshold) {
  digitalWrite(ledPin, HIGH);
 } else {
  digitalWrite(ledPin, LOW);
 }
My question now:
The serial print gives me exactly 1kg if I put on a bottle of 1kg to the sensor. That’s great but I do not understand from where I can get this value to use for further processing?
I cannot use directly the analogValue, right?
Hope you understand my question.
Many thanks
BR