Go Down

Topic: 64 yr old newby would like some help (Read 11116 times) previous topic - next topic

Coding Badly


I prefer SESCWW, TWSBIEFP, and NBPB for my memory enhancing needs.


larryd

#301
Jan 14, 2018, 02:41 am Last Edit: Jan 14, 2018, 02:42 am by larryd
Ohh.. You have a MED, Memory Encapsulation Device...

This is my GCM QAED, Quick Access Encapsulation Device.

When you spend lot and lots of dollars with suppliers ya got to get something back, pens, notepad protectors, memory sticks (with their latest catalog on it), post-it-labels, small LED torches/flashlights etc.

Tom... :)
And there's





No technical PMs.
The last thing you did is where you should start looking.

TomGeorge

#302
Jan 14, 2018, 02:42 am Last Edit: Jan 14, 2018, 11:03 am by Coding Badly
Hi,
LOL..
I love it, especially the NPBP .
The SESCWW I'll definitly look for when I need to buy more WOEMs.

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

TomGeorge

#303
Jan 14, 2018, 02:46 am Last Edit: Jan 14, 2018, 02:47 am by TomGeorge
And there's


Yes, they look so cool in a lab jacket.

The boss had a pen holder pouch sewn into the pocket of our last work shirts.

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

Coding Badly

The SESCWW I'll definitly look for when I need to buy more WOEMs.
They are occasionally on sale at a great price.  But, I believe the great price requires a visit to a physical store.


RayJorgensen

I was hunting around for "soil PH sensr" and ran across "map", if I'm understanding this right I can use the low value of my soil moisture sensor (400 which is wet) set it as 100 and my high value (1023 dry) set as 1 and turn that to values between 1 and 100 or a percentage?

Percent makes much more sense that values between 400 and 1023.

The reference has sample of this;  y = map(x, 1, 50, 50, 1);

So would I write this:

     soil_moisture = analogRead(A0);
     y = map(Soil_moisture, 1, 100, 100, 1);
     Soil_moisture == y

This is a bit confusing to me.

Here's the section of code to read the sensor

Code: [Select]
void TaskSoil_moisture()
{
  soil_moisture = analogRead(A0);
  //Serial.println(soil_moisture);

} //END of:        T a s k S o i l _ m o i s t u r e ( )

Wawa

soil_moisture = map(analogRead(A0), 400, 1023, 100, 0);

You might need "constrain" if the A/D value can get below 400.
Leo..

larryd

#307
Jan 16, 2018, 12:30 am Last Edit: Jan 16, 2018, 12:38 am by larryd
Also, when you think a certain soil reading means it is time to start watering, it might be better to turn on the irrigation for a period of time (example 1/2 hour), rather than turning it off when the moisture hits an upper value.


BTW
Suggest you have alarm annunciation when abnormal conditions exist.



.
No technical PMs.
The last thing you did is where you should start looking.

TomGeorge

#308
Jan 16, 2018, 12:33 am Last Edit: Jan 16, 2018, 12:34 am by TomGeorge
Hi,
soil_moisture = map(analogRead(A0), 400, 1023, 100, 0);

You might need "constrain" if the A/D value can get below 400.
Leo..
Yes, the map function is like you doing a graph and marking two points for the conversion process.
In this case

Code: [Select]
soil_moisture = map(analogRead(A0), 400, 1023, 100, 0);
inputs from 400 to 1023, will give outputs of 100 to 0.
However inputs below 400 , will also produce outputs over 100.
Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

RayJorgensen

Thanks Wawa,  That makes sense to me.  Why can't they give examples like this?  The x+y=Z never has done it for me - too much like algebra and I flunked that!!  Geometry - piece of cake - it makes sense to me and I ace'd it.

RayJorgensen

I agree with the timer Larry, but to start with I need to figure out how long to set the timer!

Tom, the values I have at this time probably aren't valid.  I need to test them is soil and then I will adjust.  It's hard to stick the probes in at 0 degrees!! >:(

larryd

0 degrees on the right, 90 degrees is up, 180 degrees is to the left and 270 degrees is down. ;)




It's -5°C today, quite balmy. :)


No technical PMs.
The last thing you did is where you should start looking.

RayJorgensen

I can convert C to F in my head pretty close.  That is not balmy and you aren't sticking probes in the ground either!!

RayJorgensen

I'm adding a timer in for how long the irrigation is on as suggested and I'm stuck.  The error is on line 282.

As always, help is appreciated.

cattledog

#314
Jan 17, 2018, 01:26 am Last Edit: Jan 17, 2018, 01:27 am by cattledog
Code: [Select]
TaskIrrigation();

You are getting an error here because the function has not been declared.

https://www.arduino.cc/en/Reference/FunctionDeclaration

Note how all the other functions called in the states TaskXXX() have separate function declarations. These declarations must be outside of setup() or loop().

You need to do the same with TaskIrrigation(). I don't know if there are any input parameters or return values, but if not

Code: [Select]
//                 T a s k I r r i g a t i o n ( )
//==================================================================
void TaskIrrigation()
{
 
  //task code here


} //END of:     T a s k I r r i g a t i o n ( )   

Go Up