Maintenance notice: These forum archives are read-only, and will be removed shortly. Please visit our forums at their new location, https://www.evilmadscientist.com/forums/.

Alpha Clock 5 - seconds spinner

wbpwbp
edited January 2013 in General
I like the "seconds spinner" in the A5 clock, but wanted a little more resolution.  Here's the resulting code:

1) set 2 values based on current seconds:

  byte temp1, temp2;  // wbp

    byte segs1[] = { 15, 15, 16, 16, 5, 5, 17, 17, 8, 8, 9, 9, 4, 4, 14, 14};  // wbp
    byte segs2[] = { 0,  16,  0,  5, 0, 17, 0,  8, 0, 9, 0, 4, 0, 14, 0, 15};  // wbp
    temp1 = segs1[(SecNow*4)/15];  // wbp
    temp2 = segs2[(SecNow*4)/15];  // wbp

2) display:

        a5loadOSB_Segment (temp1, a5_brightLevel);  // wbp
        if (temp2 > 0)  // wbp
          a5loadOSB_Segment (temp2, a5_brightLevel);  // wbp

Enjoy!
William
Sign In or Register to comment.