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.
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.
I see alot have the directives have changed since 15yrs ago Isaac used to seeing int main and if then ... goto
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.
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.
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?
AWOL:
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.
djjester611:
Sorry but most of typing is done by phone
Right, I see.
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?
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
i will be monitoring posts throughout the day to keep up with everything as well.
binarytoDecimal is what i originally came across then i saw it written as bcdToDec
if((hours=<18 && minutes==00)||(hours=>6&&minutes==00)||(hours=>7&&hours=<17);
digitalWrite(fan, HIGH);
{
else
}
digitalWrite(fan,LOW);
That's a novel use of "else".
I'd be surprised if that compiles, and the semicolon at the end of the "if" would render it useless anyway.
How else can I rewrite it
Google: c tutorial if statement
There are about 3, if not 4, things wrong with the way you have done that. A tutorial will help you out there. There are some nice YouTube ones too.
Sorry its been so long but I have been searching and still cannot find what I'm looking for. I have come across time based tasks but with no RTC and one other issue I have come across I need pumps alternating every 15 mins or 900000 Millis but after reading milliseconds doesn't go that high . I'm sorry but I feel hopeless. Everyone else's aquarium. Controllers are set up recalling last time intervals
900000 Millis but after reading milliseconds doesn't go that high
Where did you read that?
It goes way higher than that.
How high value do that actually go
4294967295 milliseconds (49.71 days)