Go Down

Topic: Potted plant watering system. (Involves water pumps.) (Read 12679 times) previous topic - next topic

wildbill

One more thing to consider is some testing. IIRC, you don't want to worry about specific hardware at this point, but you can simulate it easily enough with some leds (assuming you at least have the RTC). You have more than enough code to start testing, indeed, you will likely have to comment some of it out while you test the most basic functions. Trying to write it all and test it big bang is  going to be painful, particularly given your level of experience.

lost_and_confused

Yeah, ok.

I now see the problem with the "resetting" value thing.

It maybe was missed because I was more concerned with getting it to compile.

Being winter here, I think I need to be more careful with the codes, as I don't think I am a winter person.  The flu is going around and it is knocking people around.

Self included.  :(

I think I shall have to shut up shortly because I am tired, and obviously not taking in everything which is said.

I shall try to resolve this issue with the "sensor" and "sensorPins" names too.

lost_and_confused

Ok folks, here is a new sketch.

Totally re-written.

It is a trial just now to get the LED's doing what I want.

Ignore the RTC stuff.

But with LED's and resistor on the output pins, LED # 5 doesn't glow.

Strange, because if I run another script which writes to that pin, the LED works.

If I move the wire from where # 5 is and touch # 4, the LED comes on with # 4.

AWOL

#48
Jul 21, 2012, 10:44 am Last Edit: Jul 21, 2012, 10:52 am by AWOL Reason: 1
Code: [Select]
    sol_run_time[5] = 20;
Code: [Select]
   level[6] = 20;      
I gave up reading there.

It is considered polite to remove commented-out code before posting.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

lost_and_confused

Fair enough AWOL.

But I have spent a lot of time writing the whole thing out long hand.

I still can't get my head around the
const byte solenoid_outputPins [5] = {8, 9 10, 11, 12};

It is strange if that line is not commented it says there is a problem with it.


lost_and_confused

P.S.

I changed the line to:
const byte solenoid_outputPins [] = {8, 9 10, 11, 12};

Still gives me an error.

Somehow I can't get my head around that this is supposed to do.

AWOL

#51
Jul 21, 2012, 11:03 am Last Edit: Jul 21, 2012, 11:07 am by AWOL Reason: 1
I don't understand you - you don't use that array, so why is it there at all?

Quote
I have spent a lot of time writing the whole thing out long hand.

Why?
Humans are lousy at repetition, but computers are designed for the job - why do the legwork yourself?

I'm posting from a tablet, so can't compile your code, but I can see it is far too long.

If you go into the IDE, click on "File/Examples/Control" you'll see a ready-made example on arrays.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

lost_and_confused

Yes, I do want to use the array.

But as I am not making any progress, I am writing the whole thing the long way.

Last night it was working - all 5 LED's were working in sequence.

But what I "realised" was the pins I used and their physical location.

As I used 4 - 9 4 - 8 are on one set of headers and 9 is on the next.

So I edited the whole code and made it 9 - 12.

That was all the pins are on the same row of header pins.  This will allow me to use ONE connection/mech' to run off to the board.

But now the 5'th LED doesn't glow.


AWOL

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

dxw00d

Code: [Select]
const byte solenoid_outputPins [5] = {8, 9 10, 11, 12};
                            missing comma ^

AWOL

Why are you fixated on code you don't use, but seem to ignore faulty code you do use?
See reply #48.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

lost_and_confused

(Blush)

I leave commented code in, or old code, because sometimes it worked, and I leave it there to prompt me what was happening if something goes wrong.

Other times it is my efforts and I leave them there to show me what doesn't work, to save me trying that structure again.


I'm taking it I have to put the:
const  byte what_ever_it_is[] = {1,2,3,4} has to be in setup()?


I can remark out those "sol_run_time"  and "level" lines and it still does the same thing.  So yes, maybe they are problematic for me in the future, but alas just now I am "stuck" on why LED # 5 isn't glowing.

Other programs make it work, and if I move it to pin 7 (where it was 12) it works.

So there is something "stopping" pin 12 being used in this code/sketch.

Maybe it isn't the ONLY problem, but it would seem I am "fixated on it".
I don't know what to do now.

I feel chasing other problems now is not going to help me understand what is going on with this now.

AWOL

#57
Jul 21, 2012, 11:50 am Last Edit: Jul 21, 2012, 11:52 am by AWOL Reason: 1
Quote
I'm taking it I have to put the:
const  byte what_ever_it_is[] = {1,2,3,4} has to be in setup()?

No, because then its scope will be limited to "setup", and I'm fairly sure you'll want to use those pins elsewhere.

No, in reply #48 I quoted two short items of code, both with the same semantic error (the compiler would have caught any syntax errors).
Look at the declarations of the arrays described and look at the quoted code, and you'll see what I'm going on about.

Programming isn't always about having the error handed to you, often the error is subtle and oblique.

I'm not even saying that the errors I highlighted are causing the problem you're seeing, but until you fix the obvious bugs, the subtle ones will remain masked, which is why I stopped reading when I saw them.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

dxw00d

For extra help, read http://arduino.cc/en/Reference/Array - look for the bold text.

lost_and_confused

dxwood,

Reading it.

Ok, so I put:

int solenoid_outputPins[] = {8, 9 10, 11, 12};

In my code, to set up the array of output pins.
This was derived from the example given on the link you posted.
(Extract)
All of the methods below are valid ways to create (declare) an array.

  int myInts[6];
  int myPins[] = {2, 4, 8, 3, 6};
  int mySensVals[6] = {2, 4, -8, 3, 2};
  char message[6] = "hello";
So any can work.

I went for # 2.

But when I compile I get this:

V4b:21: error: expected `}' before numeric constant
V4b:21: error: expected ',' or ';' before numeric constant
V4b:21: error: expected declaration before '}' token
21 is the line I posted above.

Yeah:  Clear as mud.
Well, again, I put:
int solenoid_outputPins[] = {8, 9 10, 11, 12};

Beyond me to understand what it means.



Go Up