Page 1 of 1

What does this code do?

Posted: Sun Dec 21, 2014 7:15 pm
by cosmith71
Too much punctuation! Can somebody 'splain?

Code: Select all

        WhiteChannel=millis()%2000<1000?0:100;
Thanks,

--Colin

Re: What does this code do?

Posted: Sun Dec 21, 2014 7:23 pm
by lnevo
StartTIme+Offset%Repeat<RunTime is the basis for most of the timechecks. You arent using the offset above but if you wanted thats how it works.

The ?0:100 is like an if else so if the condiction prior is true then 0 else 100

Re: What does this code do?

Posted: Sun Dec 21, 2014 7:29 pm
by cosmith71
lnevo wrote:StartTIme+Offset%Repeat<RunTime is the basis for most of the timechecks. You arent using the offset above but if you wanted thats how it works.

The ?0:100 is like an if else so if the condiction prior is true then 0 else 100
You hurt my brain a little just then.

So, does this mean if millis mod 2000 is less than 1000 then WhiteChannel=0 else WhiteChannel=100?

--Colin

Re: What does this code do?

Posted: Sun Dec 21, 2014 7:30 pm
by lnevo
Why yes, yes it does :)

Re: What does this code do?

Posted: Sun Dec 21, 2014 7:34 pm
by cosmith71
Thanks! :D

--Colin