How do I invert a reading in UIFLow2?
-
Ok so my brain has totally failed today which leaves me with the following question.
This is the code I have so far:
When the soil level Moisture increases the reading goes down. For correct readings I need the level to work in the complete reverse and go up as the moisture increases.
What do I need to change to invert the reading as numbers is hard for me to calculate today?
-
@ajb2k3 if greater than > the desired value?
-
Sorry why I mean is that when the Moisture level in the soil increases, the ADC value goes down and after the percentage calculation the percentage value goes down.
What I want is the percentage reading to go in the reverse but I cant seam to work out how.
-
@ajb2k3 I understood and I suggested turning on the water when the soil was dry, which is what you wanted.
So change the <20 to > 'some value' that is too dry.
I have a ENV Pro that I thought the gas reading was in a direction that was not logical (helpful to the Brain) so I reversed it to display an increase, instead of a decrease.VOC = (1 / gas_resistance) * 10000;So I guess you could do a reciprocal of the ADC reading and scale it to suit, but that seems like more work to me!
I only jumped in because your UIFlow program reads like C!!! -
@teastain Thanks you suggestion works I just did >50% to operate the pump and uploaded the code to the project zone.
What do you mean reads like C, is that a good thing or a bad thing because I was following a Maths exam guide for the formula as I had forgotten it.
-
@ajb2k3
This is Arduino C:
It reads VERBALLY just like your UIFlow program!If ((ADC8 / 4096) * 100 < 20) { DigitalWrite(9 = HIGH) } else{ DigitalWrite(9 = LOW) }But brackets and things.
-Cheers -
@teastain Ah Ok thanks, I avoid arduino like the plague so didn't notice.
Hopefully that means that people can read the example and simply port to arduino.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login