Hi how to fix filtered value
In this DC blocking code Serial.println(filtered_value); has zero reading should be similar to Serial.print(readingx);
#include "HX711.h"
const int LOADCELL_DOUT_x = PB4;
const int LOADCELL_SCK_x = PB5;
const int LOADCELL_DOUT_y = PB4;
const int LOADCELL_SCK_y = PB5;
HX711 scalex;
HX711 scaley;
///////////////////
int readingx;
int sample = 0;
int last_sample = 0;
double a = 0;
long shifted_filter = -10000;
//long shifted_filter = -1;
//////////////////
void setup() {
Serial.begin(115200);
scalex.begin(LOADCELL_DOUT_x, LOADCELL_SCK_x);
scaley.begin(LOADCELL_DOUT_y, LOADCELL_SCK_y);
}
void loop() {
/////////////////
last_sample = sample;
//a+=0.1; sample = analogRead(PA0);
a+=0.1; sample = readingx;
long shiftedFCL = shifted_filter + (long)((sample-last_sample)<<8);
shifted_filter = shiftedFCL - (shiftedFCL>>8);
long filtered_value = (shifted_filter+128)>>8;
///////////////
long readingx = scalex.read();
long readingy = scaley.read();
Serial.print("x = ");
Serial.print(readingx);
// Serial.print(sample);
Serial.print(" DCx = ");
Serial.println(filtered_value); // on monitor is = 0 ???
}