Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to make a binary switch that switches after a fixed given interval. Why doesn't the following work:

step = .1;
t = Dynamic[Clock[{0, 5, step}, 5, 1] ]; 
Dynamic[t >=  2]
share|improve this question
Could someone with at least 300 points of reputation please add some more tags? – zab Apr 28 '14 at 12:57
Dynamic[Clock[] > .5] – Vitaliy Kaurov Apr 28 '14 at 13:10
up vote 8 down vote accepted

Note that you've defined t as a Dynamic expression. A relational operator like GreaterEqual (>=) works with numeric expressions like the result of Clock. You could try something like this to get a displayed output that eventually switches from False to True:

step = .1;
Dynamic[{t, t = Clock[{0., 5., step}, 5., 1]; t >= 2}]
share|improve this answer
Thanks so much! – zab Apr 28 '14 at 13:18

I couldn't help thinking about this question even after I voted for billsphere's perfectly satisfactory answer. Finally, I concluded that Trigger would be a better way to implement the requested functionality. It is just as easy to use as Clock and throws in a nice little control panel as a bonus.

With[{dt = 1, tmax = 10, threshold = 4}, 
    Dynamic @ Row[{t, " > ", threshold, " is ", t > threshold}],
    Trigger[Dynamic @ t, {0, tmax, dt}, dt]}]]


share|improve this answer
@ m_goldberg, nope, Trigger doesn't work on the Linux version :-( – zab May 2 '14 at 2:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.