alter library, cycle speed problem , load Sensor, HX711-Library,

Hi Arduino-Community,

I got a really unusaual Problem with cycle speed.
I´m combining 4 load sensors with the Sparfunk Load Combinator and use the Load Cell Amp HX711.

In my projekt i need to use two of the HX711 simultaneausly so I used the Programm CodeBlocks to open the HX711 library and then i cloned the whole library and altert all method names.
In the end I got one HX711 and one HX712 Library and the measuring works without any problem.

But after a while I recognized that my cloned code needs almoast 100ms to proceed.

Can anyone help me with that?

Greetings Florian

kraftmesspedale_doppel__Geschwindigkeit_.ino (1.36 KB)

HX711.h (2.46 KB)

HX711.cpp (2.66 KB)

HX712.cpp (2.68 KB)

HX712.h (2.47 KB)

Solved,
its not Problem of the library one Amp is simply not responding propperly

Cheers

FlorMaye:
In my projekt i need to use two of the HX711 simultaneausly so I used the Programm CodeBlocks to open the HX711 library and then i cloned the whole library and altert all method names.
In the end I got one HX711 and one HX712 Library and the measuring works without any problem.

Totally defeats the purpose of Object Oriented Programming.

The better approach would be to instantiate multiple objects of the HX711 class.

I am not very familiar with code blocks and had no idea where the object is generated in the libary and how the class structure works.
So this was only idea to solve it.

Maybe you can give me some advise, i learnd programming just with netbeans

cheers flo

Netbeans is for Java, right? That’s an Object Oriented Language as well. Principle is the same in C++.

You could instantiate two objects of the HX711 class:

HX711 scale1(dataPin1, clockPin1);
HX711 scale2(dataPin2, clockPin2);

Or, an array of HX711 objects:

HX711 scales[] = {{dataPin1, clockPin1}, {dataPin2, clockPin2}};

Hi gfvalvo,
thanks for your Help.

I think I got it now how to instantiate a objekt right.

Cheers Flo