Showing posts with label Dementia clock. Show all posts
Showing posts with label Dementia clock. Show all posts

Day clock page

Following on from yesterday's Dementia Day Clock, I decided to create a new Day Clock with a little more information - for instance - accurate time.

Day clock on my Lumia 950. Click the image to load the new Day Clock.

I managed to export the data from the Perpetual Calendar for the BBC microcomputer using BeebEm and then wrote a script to convert the data from a BBC text file into a JSON file. The data contains the dates of various interesting anniversaries, and so I thought it would be a nice touch to show these on the new day clock, including a calculation of how long ago the event took place.  For example today is the 41 year anniversary of the UK Sex Discrimination Act 1975.

BeebEm has some really useful tools, most notably the 'export' function which allows you to export one or more files from a BBC disk image to a PC format. This means that I can code a file on the BBC microcomputer, but still access or edit it on my Windows 10 machine. Yay!

I then added in 'red-letter' days, or other recurring events including holidays and Pagan festivals (from Pagan Calendar). I cannot be absolutely sure I haven't made any errors here, but I'll keep checking that this works and then add some more date/time information as and when.

The final touch was to put the current time into the new page tab so you can check the time in your list of browser tabs without navigating back to the page.

Well that's it for now. In the future I may add some other features, perhaps a background image that changes with each passing month. Maybe I shall put a Google search box in, or other widgets such as weather. Maybe I'll just sack it off and build something else.


Come back soon for more nerdy stuff.

If you liked this post, then you might also like to watch some bouncing balls, or just play a game of Have Spell Will Travel.

Dementia Day Clock

The Dementia Day Clock is a clock that tells the time simply as 'morning', 'afternoon', 'evening' and 'night' and is specifically designed to be of help to people with memory problems.

Today I have reworked my Dementia Clock so that it runs in your browser, rather than a stand-alone Windows application. Click the image below to load.

The Dementia Day Clock running in my Edge Browser.
I intend to keep my Dementia clock available for as long as I can continue to run the server. It will be available advert-free forever. Any suggestions are welcome and if you wish to help support this project then there is a donate button on my website.



#dementia
#clock
#dementiadayclock

Dementia Clock

The Dementia Clock is a Windows application designed to help people living with dementia by simply displaying the time of day as morning, afternoon, evening or night.


Follow this link to DOWNLOAD the Dementia Clock (including source code).

BBC BASIC for Windows source code follows.  Please modify and share freely.

     REM A clock for dementia sufferers
     REM T Street
     REM 2013-11-21
     REM this is a very simple program for displaying a simple clock
     REM the functionality is limited to only displaying the current
     REM day of the week
     REM and whether it is morning, afternoon, evening, or night
     REM with the intention of being an aid for people with memory problems

     REM requires BBC BASIC for Windows
     REM select Options -> lowercase keywords

     
(_Version_Info_)
     GAME_NAME$ = "Dementia Clock"
     VERSION$ = "1.01"

     (_Initialising_)
     REM error handling (displays message and quits)
     
ON ERROR SYS "MessageBox", @hwnd%, REPORT$ + " at line " + STR$ERL, "Error", 48:QUIT
     
REM event handler for quit button
     
ON CLOSE PROC_quit : RETURN
     
REM set size of window
     
VDU 23,22,880;186;32,32,2,0
     REM set window text
     
SYS "SetWindowText", @hwnd%, GAME_NAME$+" version "+VERSION$+" tinyurl.com/superdecade"
     PROC_preventResize
     OFF  : REM turn text cursor
     
*esc off
     COLOUR 1, 255, 255, 0   : REM yellow
     
COLOUR 2, 0, 0, 0       : REM black
     
*font Times New Roman, 48b
     VDU 5 :REM allow text to be printed at graphics cursor


     REM =========== MAIN LOOP =============
     
REPEAT
       PROC
_display(" It is "+FN_getDay( TIME$ )+" "+FN_getTimeFrame( FN_getHours( TIME$ ) )+".")
       SYS "Sleep", 1000 : REM sleep for 1 second
     
UNTIL FALSE
     
REM ===================================


     
DEFPROC_quit
     REM quit handler
     REM user gets 4 seconds to press ENTER key or program continues
     
LOCAL g%
     PROC_display("Now press Enter to quit.")
     g% = INKEY(400)
     IF g% = 13 THEN
       QUIT
     ENDIF
     ENDPROC


     
DEFPROC_display( t$ )
     REM displays text at approx half way along screen
     REM no time to code a proper centering routine
     
COLOUR 1+128 : CLS  : REM clear background to yellow
     
GCOL 2     : REM set graphics colour to red (text counts as graphics after vdu 5)
     
MOVE 190,290
     PRINT t$
     ENDPROC


     
DEFFN_getHours( t$ )
     REM returns the number of hours from the string passed
     REM assuming t$ is a string obtained from time$
     
= VAL( MID$(t$, 17, 2) )


     DEFFN_getTimeFrame( n% )
     REM returns a time such as "morning" etc depending on the string passed
     REM midnight - 6am = night
     REM 6am - noon     = morning
     REM noon - 6pm     = afternoon
     REM gpm - midnight = evening
     
LOCAL a$
     CASE TRUE OF
       WHEN
n% >= 0 AND n% < 6 a$ = "night"
       WHEN n% >= 6 AND n% < 12 a$ = "morning"
       WHEN n% >= 12 AND n% <18 a$ = "afternoon"
       WHEN n% >= 18 AND n% <= 23 a$ = "evening"
       OTHERWISE a$ = "undefined"
     ENDCASE
     
= a$


     DEFFN_getDay( t$ )
     REM returns a string representing the current day
     REM assuming t$ is a string obtained from time$
     
LOCAL part$
     part$ = LEFT$( t$, 3)
     CASE part$ OF
       WHEN
"Mon" a$ = "Monday"
       WHEN "Tue" a$ = "Tuesday"
       WHEN "Wed" a$ = "Wednesday"
       WHEN "Thu" a$ = "Thursday"
       WHEN "Fri" a$ = "Friday"
       WHEN "Sat" a$ = "Saturday"
       WHEN "Sun" a$ = "Sunday"
     ENDCASE
     
= a$


     DEF PROC_preventResize
     REM prevent user resizing window
     
PRIVATE ws%
     SYS "GetWindowLong", @hwnd%, -16 TO ws%
     REM prevent user maximising window
     
SYS "SetWindowLong", @hwnd%, -16, ws% AND NOT &50000
     ENDPROC


Label