Load Cell Input For Sim Racing Pedals Causing Stuttering and Delay

Hello,

I recently built some sim racing pedals using 2 potentiometers, a load cell an HX711 boarrd and a Pro Micro. However, when the brake (loadcell) is disabled in the code, I have no issues with the potentiometers and they work smoothly. When I enable the load cell in the code, the potentiometers stutter as an input and aren’t a smooth axis. Alongside this, the load cell input has a lag time from pressing the pedal to showing an input as well as also stuttering. My code is ayttached below, any suggestions are welcome.

Thank you.

Sim Pedals

#include <HX711.h>
#define calibration_factor -3000 // Do your calibration first.
#define DOUT  3
#define CLK  2
#include <Joystick.h>


HX711 scale;

Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID, 
  JOYSTICK_TYPE_MULTI_AXIS, 0, 0,
  false, false, true, false, false, false,
  false, true, false, true, false);;

// Variables
int gas = A2;
int clutch = A0;

// init joystick libary
void setup() {
  Joystick.begin();
  Serial.begin(9600);
  scale.begin(DOUT, CLK);
  scale.set_scale(calibration_factor);
  scale.tare();
}

void loop() {
  
  // Gas
  Joystick.setThrottle(analogRead(gas));
  // Clutch
  Joystick.setZAxis(analogRead(clutch));
  //Brake
  Joystick.setBrake(scale.get_units());
  //Delay
  delay(20);
}

Perhaps write something that just reads the load cell. Use millis or micros to see how long it takes.