bogde / HX711

An Arduino library to interface the Avia Semiconductor HX711 24-Bit Analog-to-Digital Converter (ADC) for Weight Scales.
MIT License
908 stars 540 forks source link

Running two instances of HX711.h #108

Open stevethestrain opened 6 years ago

stevethestrain commented 6 years ago

Firstly, @bogde thanks for this excellent library. I can't get scale.set_gain to go into the 32 scale mode with a scale.set_gain(32) call but that's probably me being stupid. I'd like to use two HX711s (I got 5 boards from Amazon for about 10 /euros) ! The first, connected to a load cell, is working perfectly. I'm using it to control a linear actuator to force a BLDC motor driven drilling machine into work. What I'd like to do is use a precision low value resistor in series with the motor supply to measure current draw. I don't think it will be to difficult to get the HX711 to see and amplify the voltage drop across the resistor - probably common Gnd and one SG I/P and use the other to see the volt drop - which will only be a few mV,

But my question is - can I call two instances of the library with two HX711s (obviously connected to different pins !) so I call one exactly as I'm doing at the moment to get load and tare and then call the other to get 'tare' - volts zero offset - and 'load' which will be voltage drop and therefore current. Hope that makes sense !

kenneth558 commented 5 years ago

I have the same desire. I figure that a developer by default should design a class to be able to be instantiated at least twice.