Pages: 1 [2] 3   Go Down
Author Topic: Salt Reef seasons IF Then Confusion!?  (Read 2291 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25770
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is the fan both on and off?
Schrödinger's fan?
Logged

"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.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I will be rewriting as
If(times---------eg------!fanOn);
   Else = !fanOff;
Not if you want the code to compile, you won't.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had originally laid out the sketch I sequence of operation after delving into the if else
Statement I realized that if the times are true then fan will be off and else it would be off.
I have off tomorrow and will be posting better sketchhooefully. I will be controlling a metal halide,fan ,compact fluorescent, led and (2power heads that
Will be on a 15min alternating cycle.900,000millis.


I know I'm making it harder on myself then it needs to be but my programming days are years behind me and it was c++. With the tank my dad built I thought no better time than now to get back into it. 
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but my programming days are years behind me and it was c++.
Good thing the Arduino isn't programmed using C++ then. Oh, wait. It is.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I thought that arduino was written with c language not c++ persay.
By the way hi Paul long time, no deal with my issues  smiley-grin
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I thought that arduino was written with c language not c++ persay.
No. It is C++ all the way. Since C++ is a superset of C, you get all of C, warts and all, along with it.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I see alot have the directives have changed since 15yrs ago Isaac used to seeing int main and if then ... goto
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25770
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
sed to seeing int main and if then ... goto
All still there if you look closely enough...apart from the g-word.
We don't mention it in polite society, the might be noobs listening who may think it clever to try one.
Logged

"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.

Offline Offline
Edison Member
*
Karma: 29
Posts: 2361
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

there's nothing wrong with the G word if used correctly.. after all, if not for the G word, how would something like this be done..

mov eax,1234;
@@address;
cmp,rep,whatever
....
...
cmp eax,123;
jne address;
...
exit, return;

I understand there's no real need in C or a higher level language, but goto is quite handy at times, but in all the years i've been programming i've only needed
to use it goto (label in pascal) maybe 2 or 3 times, purely due to all the nested loops i was using, it was simply easier within 15 nested if statements to use
a label/goto/jmp and get out that way..

Reason for not using them, it can make the code very very very difficult to read, but if you only use 1 or 2, you'll be fine.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

my next ? does the arduino ide not except some commands or is all of c language excepted. only reason i ask is i have seen some command abbreviated or rewritten?
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is the fan both on and off?
Schrödinger's fan?

Thank you AWOL for that. smiley

We'll never know will we .... until we open the box.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry but most of typing is done by phone

Right, I see.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25770
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
does the arduino ide not except some commands or is all of c language excepted. only reason i ask is i have seen some command abbreviated or rewritten?
Did you mean "accepted"?
Which commands do you think you have you seen abbreviated or rewritten?
Logged

"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.

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

if((hours=<18 && minutes==00)||(hours=>6&&minutes==00)||(hours=>7&&hours=<17);
digitalWrite(fan, HIGH);
{
    else
}
digitalWrite(fan,LOW);

i think this is what your asking for AWOL and Nick;

my original sketch is the that everyting was laid out corresponding to time of a day as if you were watching a clock go by now i think if i set the time to only be on during those time specified then it will be off for remainder.

each Season or months will have their own variables that will be controlling things like fan, 2 lights , thrown into sketch will be an automated moon phase(hopefully). Sorry i would have rewritten alot of it last night but i was spent and today i have my daughter field trip so. i will be coding as soon as i get the chance.

btw I thank all of you for responding as quickly as you have and for not giving be hard time  smiley-mr-green i will be monitoring posts throughout the day to keep up with everything as well.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

binarytoDecimal is what i originally came across then i saw it written as bcdToDec
Logged

Pages: 1 [2] 3   Go Up
Jump to: