Andrei IRL
Senior Member
Hello everyone.
I am building a sensor using strain gauge.
The sensor is built and amplifier made.
I am using READADC10 to convert my voltage reading into a variable, nothing new there.
I am not building a weighing scales but only a device that can monitor sensor reading and trigger a relay if the preset value has been reached.
Here is my issue, i have a routine at the beginning of the program that will be ran for 15 seconds.
This routine is taking ADC readings and i need it to same the smallest reading it gets within that 15 second window.
Then this value will be stored into EEPROM.
As i need the sensor to read in both directions, my at-rest ADC reading is somewhere in the middle of the ADC10 reading range, but can be between 400 and 600.
So my question is, how can i run a routine that will monitor ADC reading for 15 seconds and saves the smallest reading when value of ZERO will already be assigned to my variable by default?
Below is the example program i am trying to use.
I am building a sensor using strain gauge.
The sensor is built and amplifier made.
I am using READADC10 to convert my voltage reading into a variable, nothing new there.
I am not building a weighing scales but only a device that can monitor sensor reading and trigger a relay if the preset value has been reached.
Here is my issue, i have a routine at the beginning of the program that will be ran for 15 seconds.
This routine is taking ADC readings and i need it to same the smallest reading it gets within that 15 second window.
Then this value will be stored into EEPROM.
As i need the sensor to read in both directions, my at-rest ADC reading is somewhere in the middle of the ADC10 reading range, but can be between 400 and 600.
So my question is, how can i run a routine that will monitor ADC reading for 15 seconds and saves the smallest reading when value of ZERO will already be assigned to my variable by default?
Below is the example program i am trying to use.
Code:
do while time < 15
time = time +1
toggle greenled
readadc10 4,w3 'w3-b6/b7
if w3<w4 then
let w4 = w3
end if
pause 100
loop