B4R Question weighing-scale balance indicator

Mostez

Active Member
Hello;
I use a timer to read weight from HX711 module in 1000 ms interval, the readings may go up or down slightly until load cell gets stable. I want to test the reading until there is no any change then stop reading from HX711 and indicate that by turning LED on or display it on LCD. if another change occured, for example weight object removed, start displaying again Like:

example video in this link

B4X:
private Sub ScaleTimer_Tick()
    Dim Raw As Int = GetWeight() 'read from HX711
    
    If IsStable(Raw) Then
        TurnLedON 'turn led on then stop displaying any weight changes, until another change occures
    Else
        TurnLedOFF
        DisplayWeightChanges(Raw) 'display weight changes on LCD until gets stable
    End If

End Sub
 

emexes

Well-Known Member
Licensed User
I want to test the reading until there is not any change
Probably better to allow a little bit of change, otherwise if the scale has any random noise in the lowest digit, you'll be waiting forever.
B4X:
'''If NewValue <> LastValue Then
If Abs(NewValue - LastValue) > NoiseLevel Then
then stop reading from HX711
If you stop reading, that could make it difficult to detect:
if another change occurred ... start displaying again
 
Top