How do i Add equations to hx711 scales reading output

Hi I've made a dyno to test brushless motors. I'm using a hydro gear motor as the load, with a flow restrict valve to increase/decrease load.

I have the load cell connected to a half metre bar from the gear motor's shaft. So as the load is applied the bar pushes on the cell and gives a kilogram reading. I would like to add an equation to the output (kgs) so instead of giving weight it would be torque. The equation needs to be: scale reading x 9.81 x 0.500/3.75=torque

This is the code I'm using to run the load cell:

/*
 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).

 This example demonstrates basic scale output. See the calibration sketch to get the calibration_factor for your
 specific load cell setup.

 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 -> DAT
 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 -108650.00 //This value is obtained using the SparkFun_HX711_Calibration sketch

#define LOADCELL_DOUT_PIN  3
#define LOADCELL_SCK_PIN  2

HX711 scale;

void setup() {
  Serial.begin(9600);
  Serial.println("HX711 scale demo");

  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
  scale.set_scale(calibration_factor); //This value is obtained by using the SparkFun_HX711_Calibration sketch
  scale.tare(); //Assuming there is no weight on the scale at start up, reset the scale to 0

  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 this to kg but you'll need to refactor the calibration_factor
  Serial.println();
}

So something like

float torque = scaleReading *  9.81 * 0.599 / 3.75;

perhaps

What have you tried ?

Thank you i will give that a go. I've tried a few thing but none worked i haven't done much coding at all so finding it hard

hi I've tried putting this in my code with no luck, could show me how and where it should go?

Post the whole sketch where you tried and explain what is wrong

Sorted it Thanks for your help ukhelibob

This is my first time using the Arduino but learnt a lot though trial and error lol
I even ended up pulling the erpm data from the esc and using it to give me horse power too. haven't fully tested the results but seems to be working. Here's my messy badly written code

#include <VescUart.h>
/** Initiate VescUart class */
VescUart UART;

#include "HX711.h"

#define calibration_factor -108650.00 //This value is obtained using the SparkFun_HX711_Calibration sketch

#define LOADCELL_DOUT_PIN  3
#define LOADCELL_SCK_PIN  2
float reading;
HX711 scale;
float RPM;
void setup() {
  Serial.begin(9600);
  Serial.println("DYNO");
    /** Setup UART port (Serial1 on Atmega32u4) */
  Serial1.begin(115200);
  
  while (!Serial) {;}

  /** Define which ports to use as UART */
  UART.setSerialPort(&Serial1);
  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
  scale.set_scale(calibration_factor); //This value is obtained by using the SparkFun_HX711_Calibration sketch
  scale.tare(); //Assuming there is no weight on the scale at start up, reset the scale to 0

  Serial.println("Readings:");
  
}

void loop() {
    /** Call the function getVescValues() to acquire data from VESC */
  if ( UART.getVescValues() ) {
    Serial.print("RPM");
    Serial.println(RPM);
    RPM = UART.data.rpm/6;
  }
  else
  {
    Serial.println("Failed to get data!");
  }
  reading = scale.get_units();
  Serial.print(reading);
  Serial.print("kgs");
  Serial.print("   torque: ");
  Serial.print(reading *  9.81 * 0.500 / 3.75);
  Serial.print(" Nm"); 
  Serial.print(" HP: ");
  Serial.print(reading * RPM / 7127);
  
  Serial.println();
  delay(500);
}