Go Down

Topic: Salt Reef seasons IF Then Confusion!? (Read 2 times) previous topic - next topic

AWOL

Quote
Is the fan both on and off?

Schrödinger's fan?
"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.

PaulS

Quote
I will be rewriting as
If(times---------eg------!fanOn);
   Else = !fanOff;

Not if you want the code to compile, you won't.

djjester611

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. 

PaulS

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.

djjester611

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

PaulS

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.

djjester611

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

AWOL

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

cjdelphi

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.

djjester611

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?

Nick Gammon


Quote
Is the fan both on and off?

Schrödinger's fan?


Thank you AWOL for that. :)

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

Nick Gammon


AWOL

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

djjester611

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.


djjester611

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

Go Up