Hello,
I'm actualy going to finish my project for sim racing pedals using load cell.
On the web I found some ispiration and I tried a lot of sketchs, but nothing working correctly for my porpose.
What I need is the the values from load cell will be sended to the pc in the faster way possible.
I already tried HX711multi library that is working but I found issue on spike when more then one load cell are connected.
So I used HX711 bogde using this code that is working (without spikes) but with low reactivity.
This is my code:
#include <HX711.h>
#define calibration_factor1 -640.0 // Do your calibration first.
#define calibration_factor2 -140.0 // Do your calibration first.
#define DOUT1 3
#define CLK1 2
#define DOUT2 4
#define CLK2 2
#include <Joystick.h>
HX711 scale1;
HX711 scale2;
/*
For the true false flags, use this list. Its all in Joystick.h
bool includeXAxis = true,
bool includeYAxis = true,
bool includeZAxis = true,
bool includeRxAxis = true,
bool includeRyAxis = true,
bool includeRzAxis = true,
bool includeRudder = true,
bool includeThrottle = true,
bool includeAccelerator = true,
bool includeBrake = true,
bool includeSteering = true);
*/
Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,
JOYSTICK_TYPE_MULTI_AXIS, 4, 3,
false, false, false, false, false, false,
false, true, true, true, false);
// Variable
//int throttle = A0;
// int brake = 2; / no need for this as we read directly from scale
//int clutch = A2;
// init joystick libary
void setup() {
// Ranges are 1023 by default
// Joystick.setBrakeRange(0, 1023);
//Joystick.setThrottleRange(0, 1023);
//Joystick.setZAxisRange(0, 255);
Joystick.begin();
Serial.begin(115200);
// Serial.flush();
scale1.begin(DOUT1, CLK1);
scale1.set_scale(calibration_factor1);
scale1.tare();
scale2.begin(DOUT2, CLK2);
scale2.set_scale(calibration_factor2);
scale2.tare();
}
void loop() {
Joystick.setThrottle(- scale2.get_units());
delay(1);
Joystick.setBrake(scale1.get_units());
delay(1);
Serial.println ( scale1.get_units());
Serial.println (- scale2.get_units());
// Joystick.setZAxis(analogRead(clutch));
// delay(1);
}
Ah actually I'm using for the Brake 2 load cells connected to HX711 and one for Throttle load cell connected to other HX711 both are connected to arduino promicro pin 2 (CLK) pin 3 (brake) pin 4 (Throttle)
Waiting for some suggestion.