Analogue Clock Second hand Sweep not Tick

edited August 2018 in Questions about Code

Hi All,

I'm busting my brains with this one.

I've taken the very simple clock sketch from the examples, but instead of drawing lines I'm using images of clock hands.

I currently have my clock working perfectly, how ever I want the second hand to sweep, not tick.

float s = map(seconds(), 0, 60, 0, 360);

The above command is the one i'm using. (s is used in my radians)

Now understandably the hand will move 6 degrees every second (tick), but how can i sweep it so its constantly moving throughout the full rotation of the clock.

Cheers Guys.

Tagged:

Answers

  • There is a new forum- better ask there

  • Seconds return seconds as an integer value. You need millis() as it returns fractions of a second.

    it will look like this:

    float s = map( (millis()%1000), 0, 1000, 0, 360);

    This is assuming that seconds() and millis() are internally synchronized. If they are not, then there is another trick. Any other posts, we go to the new forum.

    Kf

Sign In or Register to comment.