Analogue Clock

 BBS: Inland Empire Archive
Date: 01-12-93 (06:09)             Number: 393
From: HYLTON PEIMER                Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: Analogue Clock                 Conf: (2) Quik_Bas
'Here is a simple analogue clock which will start beeping before the
'hour and will play music on the hour. Hope someone finds it useful.
'-------------clock.bas---------------
CLS
Active% = 1
Start% = 3
DO
    IF Start% THEN
        FOR g% = 1 TO 25
            LOCATE g%, 1
            PRINT STRING$(80, "");
        NEXT g%
        Start% = Start% - 1
    END IF
    S$ = MID$(TIME$, 7, 2)
    M$ = MID$(TIME$, 4, 2)
    H$ = MID$(TIME$, 1, 2)
    RealHour% = VAL(H$)
    Minute% = VAL(M$)
    Second% = VAL(S$)
    IF RealHour% > 12 THEN
        LET Hour% = RealHour% - 12
    ELSE
        Hour% = RealHour%
    END IF
    SCREEN 9, , Visible%, Active%
    VIEW SCREEN (160, 60)-(480, 290)
    CLS 1
    COLOR 9, 15
    CIRCLE (320, 175), 150
    PAINT (320, 175)
    LOCATE 6, 40: PRINT "12"
    LOCATE 19, 36: PRINT " AUSTRALIA ";
    COLOR 14
    TempAngle% = 360 - (30 * Hour% + Minute% / 2)
    Angle$ = LTRIM$(STR$(TempAngle%))
    DRAW "C15TA" + Angle$ + "NU55"
    DRAW "C15TA" + Angle$ + "ND8"
    Angle$ = LTRIM$(STR$(360 - (6 * Minute%)))
    DRAW "C15TA" + Angle$ + "NU90"
    DRAW "C15TA" + Angle$ + "ND8"
    Angle$ = LTRIM$(STR$(360 - (6 * Second%)))
    DRAW "C4TA" + Angle$ + "NU100"
    DRAW "C4TA" + Angle$ + "ND10"
    LOCATE 24, 6: PRINT " Hours: "; RealHour%;
    LOCATE 24, 32: PRINT " Minutes: "; Minute%;
    LOCATE 24, 62: PRINT " Seconds: "; Second%;
    SWAP Visible%, Active%
    IF (Minute% = 59) AND (Second% > 40) AND (Second% MOD 2) > 0 THEN
        IF Second% <> OldSecond% THEN
            PLAY "MB   b  "
            OldSecond% = Second%
        END IF
    END IF
    IF Second% = 0 AND Minute% = 0 AND Used% THEN
        HourChime$ = "o3 L8 E D+ E D+ E o2 B o3 D C L2 o2 A"
        PLAY "MB X" + VARPTR$(HourChime$)
        Used% = 0
    END IF
    IF Minute% <> 0 THEN LET Used% = 1
LOOP UNTIL LEN(INKEY$)
SHELL "cls"
'----------------------stop-------------------------

... Press <Alt-A> to Adopt Me!  I need a better home.
--- Blue Wave/Max v2.01 [NR]
 * Origin: QuickSHARE's Australian HQ (03) 752-3949 (3:633/371.0)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET