hi guys
i am using at the end a load cell with the hx711
#include <HX711_ADC.h>
//HX711 constructor (dout pin, sck pin)
HX711_ADC LoadCell(8, 9);
long t;
void setup() {
Serial.begin(250000);
Serial.println("Wait...");
LoadCell.begin();
long stabilisingtime = 4000; // tare preciscion can be improved by adding a few seconds of stabilising time
LoadCell.start(stabilisingtime);
LoadCell.setCalFactor(696.0); // user set calibration factor (float)
Serial.println("Startup + tare is complete");
}
void loop() {
//update() should be called at least as often as HX711 sample rate; >10Hz@10SPS, >80Hz@80SPS
//longer delay in scetch will reduce effective sample rate (be carefull with delay() in loop)
LoadCell.update();
//get smoothed value from data set + current calibration factor
if (millis() > t + 20) {
float i = LoadCell.getData();
Serial.print("Load_cell output val: ");
Serial.println(i);
t = millis();
}
//receive from serial terminal
if (Serial.available() > 0) {
float i;
char inByte = Serial.read();
if (inByte == 't') LoadCell.tareNoDelay();
}
//check if last tare operation is complete
if (LoadCell.getTareStatus() == true) {
Serial.println("Tare complete");
}
}
along integrated with my own code
i can serial read the values and it works good
the problem is once i want to use those values to give a condition the "i" used in serial print to display the value doesnt work for me
if (failsafe> 65 and gear < 95 and (here has to be the hx711 output vale, i have used "i" with no success) > 220 and pot >= 0 and pot <= 25 )
all the other values are in range and work fine, once i want to give it the condition lets say...if wheight is more than .... do this... as shown in the part code above.
how can i do this?
thank you for reading