GY-63_MS5611/libraries/HX711/examples/HX_plotter/HX_plotter.ino

50 lines
867 B
Arduino
Raw Normal View History

2021-01-29 06:31:58 -05:00
//
// FILE: HX_plotter.ino
// AUTHOR: Rob Tillaart
// PURPOSE: HX711 demo
// URL: https://github.com/RobTillaart/HX711
2021-11-16 11:42:29 -05:00
2021-01-29 06:31:58 -05:00
#include "HX711.h"
HX711 scale;
uint8_t dataPin = 6;
uint8_t clockPin = 7;
uint32_t start, stop;
volatile float f;
2021-11-16 11:42:29 -05:00
2021-01-29 06:31:58 -05:00
void setup()
{
Serial.begin(115200);
// Serial.println(__FILE__);
// Serial.print("LIBRARY VERSION: ");
// Serial.println(HX711_LIB_VERSION);
// Serial.println();
scale.begin(dataPin, clockPin);
// TODO find a nice solution for this calibration..
2021-11-16 11:42:29 -05:00
// load cell factor 20 KG
2021-01-29 06:31:58 -05:00
// scale.set_scale(127.15);
2021-11-16 11:42:29 -05:00
// load cell factor 5 KG
scale.set_scale(420.0983); // TODO you need to calibrate this yourself.
2021-01-29 06:31:58 -05:00
// reset the scale to zero = 0
scale.tare();
}
2021-11-16 11:42:29 -05:00
2021-01-29 06:31:58 -05:00
void loop()
{
// continuous scale 4x per second
f = scale.get_units(5);
Serial.println(f);
delay(250);
}
2021-11-16 11:42:29 -05:00
2021-01-29 06:31:58 -05:00
// -- END OF FILE --
2021-11-16 11:42:29 -05:00