initial commit

This commit is contained in:
Daniel Mevec 2025-11-12 09:43:01 +01:00
commit aa3bad78f3
2 changed files with 63 additions and 0 deletions

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# HX711 Based Torque Measurement
[SparkFun HX711 Load Cell Amp Board](https://www.sparkfun.com/sparkfun-load-cell-amplifier-hx711.html)
[Arduino Library by Rob Tillaart](https://github.com/RobTillaart/HX711/)

58
arduino_strain.ino Normal file
View file

@ -0,0 +1,58 @@
//
// FILE: HX_plotter.ino
// AUTHOR: Rob Tillaart
// PURPOSE: HX711 demo
// URL: https://github.com/RobTillaart/HX711
#include "SevSeg.h"
#include "HX711.h"
HX711 scale;
// adjust pins if needed
uint8_t dataPin = A1;
uint8_t clockPin = A0;
float f;
void setup()
{
//
byte numDigits = 4;
byte digitPins[] = {2, 3, 4, 5};
byte segmentPins[] = {6, 7, 8, 9, 10, 11, 12, 13};
bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
byte hardwareConfig = COMMON_ANODE; // See README.md for options
bool updateWithDelays = false; // Default 'false' is Recommended
bool leadingZeros = false; // Use 'true' if you'd like to keep the leading zeros
bool disableDecPoint = false; // Use 'true' if your decimal point doesn't exist or isn't connected. Then, you only need to specify 7 segmentPins[]
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments,
updateWithDelays, leadingZeros, disableDecPoint);
Serial.begin(115200);
// Serial.println();
// Serial.println(__FILE__);
// Serial.print("HX711_LIB_VERSION: ");
// Serial.println(HX711_LIB_VERSION);
// Serial.println();
scale.begin(dataPin, clockPin);
scale.set_scale(1); // TODO you need to calibrate this yourself.
scale.tare();
}
void loop()
{
// continuous scale 4x per second
f = scale.get_units(1);
Serial.println(f);
delay(250);
}
// -- END OF FILE --