New Jersey
Offline
Edison Member
Karma: 24
Posts: 2345
|
 |
« Reply #45 on: July 18, 2012, 05:38:21 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Oz
Offline
God Member
Karma: 2
Posts: 560
|
 |
« Reply #46 on: July 18, 2012, 05:40:54 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Oz
Offline
God Member
Karma: 2
Posts: 560
|
 |
« Reply #47 on: July 21, 2012, 03:27:15 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 137
Posts: 19015
I don't think you connected the grounds, Dave.
|
 |
« Reply #48 on: July 21, 2012, 03:44:05 am » |
sol_run_time[5] = 20; level[6] = 20; I gave up reading there. It is considered polite to remove commented-out code before posting.
|
|
|
|
« Last Edit: July 21, 2012, 03:52:04 am by AWOL »
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Oz
Offline
God Member
Karma: 2
Posts: 560
|
 |
« Reply #49 on: July 21, 2012, 03:55:16 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Oz
Offline
God Member
Karma: 2
Posts: 560
|
 |
« Reply #50 on: July 21, 2012, 03:58:03 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 137
Posts: 19015
I don't think you connected the grounds, Dave.
|
 |
« Reply #51 on: July 21, 2012, 04:03:44 am » |
I don't understand you - you don't use that array, so why is it there at all? 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.
|
|
|
|
« Last Edit: July 21, 2012, 04:07:52 am by AWOL »
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Oz
Offline
God Member
Karma: 2
Posts: 560
|
 |
« Reply #52 on: July 21, 2012, 04:07:59 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 137
Posts: 19015
I don't think you connected the grounds, Dave.
|
 |
« Reply #53 on: July 21, 2012, 04:08:40 am » |
Have you fixed the faults in reply #48?
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3118
|
 |
« Reply #54 on: July 21, 2012, 04:09:29 am » |
const byte solenoid_outputPins [5] = {8, 9 10, 11, 12}; missing comma ^
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 137
Posts: 19015
I don't think you connected the grounds, Dave.
|
 |
« Reply #55 on: July 21, 2012, 04:14:05 am » |
Why are you fixated on code you don't use, but seem to ignore faulty code you do use? See reply #48.
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Oz
Offline
God Member
Karma: 2
Posts: 560
|
 |
« Reply #56 on: July 21, 2012, 04:43:59 am » |
(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.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 137
Posts: 19015
I don't think you connected the grounds, Dave.
|
 |
« Reply #57 on: July 21, 2012, 04:50:15 am » |
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.
|
|
|
|
« Last Edit: July 21, 2012, 04:52:52 am by AWOL »
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3118
|
 |
« Reply #58 on: July 21, 2012, 04:52:58 am » |
For extra help, read http://arduino.cc/en/Reference/Array - look for the bold text.
|
|
|
|
|
Logged
|
|
|
|
|
Oz
Offline
God Member
Karma: 2
Posts: 560
|
 |
« Reply #59 on: July 21, 2012, 05:10:10 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
|