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:
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
Dim NewValue As Int = GetWeight
If NewValue <> LastValue Then
LastChangeTime = Millis 'LastChangeTime is a global ULong
LastValue = NewValue 'global Int
Else If Millis >= LastChangeTime + 5000 Then
'stable for 5 seconds
End If