Author Topic: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font  (Read 11031 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: LCD Time and Date Using Windows Font
« Reply #15 on: December 04, 2020, 12:15:45 pm »
@SierraKen

Have you tried Alpha shadowing for the numbers?

Assuming you have all numbers printing in precise locations ie no shifting of digits because 1 o'clock uses 1 digit 11 two... you must have that to keep AM and PM from bouncing...

Anyway on a separate _Image or use screen first to build a clock of shadows by running all the numbers probably with _DONTBLEND so you have a shadow of all the numbers at same alpha level. Get a snapshot and use that 'face' as background for "lighted up" digits for the current  time. You could do it for 1 digit space and _PUTIMAGE to all the other places.

Just an idea / experiment (might not work with the font locating) and assuming by shadow we mean the line segment bars of a LED? clock.


Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: LCD Time and Date Using Windows Font
« Reply #16 on: December 04, 2020, 01:05:27 pm »
Thank you Steve for telling me those things. I will put it in a Notepad to remember by when I need it sometime.
B+, I'm not sure what you mean, but did you try the latest update with all the shadows? I do use alpha on the COLOR commands. But I also had to use COPYIMAGE and PUTIMAGE in order to put both the shadows and numbers in the same place at the same time. It works pretty spiffy actually, I've never used printed text and PUTIMAGE together like this before.
I'll work on this a little more today and see if I can line things up a little better.
Thanks also to Felippe and David. Yeah it does look more like VFD  LOL :).
« Last Edit: December 04, 2020, 01:07:22 pm by SierraKen »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: LCD Time and Date Using Windows Font
« Reply #17 on: December 04, 2020, 01:29:23 pm »
Thank you Steve for telling me those things. I will put it in a Notepad to remember by when I need it sometime.
B+, I'm not sure what you mean, but did you try the latest update with all the shadows? I do use alpha on the COLOR commands. But I also had to use COPYIMAGE and PUTIMAGE in order to put both the shadows and numbers in the same place at the same time. It works pretty spiffy actually, I've never used printed text and PUTIMAGE together like this before.
I'll work on this a little more today and see if I can line things up a little better.
Thanks also to Felippe and David. Yeah it does look more like VFD  LOL :).

Yep you caught me, I didn't try out latest, sorry, I also missed the Thread Title unless you changed it because before I swear it just said Digital Clock, no Font nor LCD (what the heck is difference LED, LCD and now VFD? god I'm getting old it looks like random selections from a Word Search Puzzle).

Sounds like you have the idea I had in mind, guess I will have to checkout the execution of our idea ;)

BTW it's not a Windows Font in my system because I tried the first post without the Font file and no workie ;-)) they usually will work with just font name as if in same folder, unless Windows changed something again on me.
« Last Edit: December 04, 2020, 01:35:08 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: LCD Time and Date Using Windows Font
« Reply #18 on: December 04, 2020, 02:26:22 pm »
Thanks B+, but I'll give you another headache, I just did some more fixes to it, so one more update. I'll add it on this post and the first post. This most likely will be the last update. I can't really get it any better than this. But I think it's cool. :) Try out the alarm too.

These are the changes I did:
'Added: Lined up background 8's and a little better.
'Added: Deleted unneeded _LOADFONT command line and went with default font for alarm settings.
'Added: Set : as permenant locations.
'Added: Minor fixes.

Scroll down for the best version, this zip has been removed.
« Last Edit: December 04, 2020, 07:25:47 pm by SierraKen »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: LCD Time and Date Using Windows Font
« Reply #19 on: December 04, 2020, 02:51:51 pm »
Yeah thanks because the 2nd zip I downloaded worked same as first, BTW recommend version number or dates for zips with modified contents, very few things remain permanent.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: LCD Time and Date Using Windows Font
« Reply #20 on: December 04, 2020, 03:11:59 pm »
Dang it! I keep getting the same dang file! No shadows put plenty of bouncing AM and PM.

I do have a headache :(Bleep this!)

@SierraKen  are attaching the correct file, it doesn't even look like the snap in reply#9
« Last Edit: December 04, 2020, 03:17:37 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: LCD Time and Date Using Windows Font
« Reply #21 on: December 04, 2020, 03:57:14 pm »
I don't know what to say B+, I just tested both of the update zip files, the first post on this forum thread, and the last one, and I pasted the code to QB64 from the zip files and they are the current ones. I'll paste the code below, but thanks for the heads up about renaming the zip files, I'll rename the current one and also post it below too.  I also just updated the other zip files above with this one, with the same name as  below: Alarm Clock LCD - 12-4-2020 update.zip

Edit: This zip has been removed, so please scroll down to the next one. Thank you.

Code: QB64: [Select]
  1. 'Digital Time and Date by SierraKen on Dec. 3, 2020.
  2. 'This is my first clock using the Lcd.ttf font.
  3. 'Added: Alarm Clock.
  4. 'Added: Minor Esc Key font fix when ending program.
  5. 'Added: Made AM/PM to stop moving.
  6. 'Added: "8" background LCD shadows.
  7. 'Added: Lined up background 8's and a little better.
  8. 'Added: Deleted unneeded _LOADFONT command line and went with default font for alarm settings.
  9. 'Added: Set : as permenant locations.
  10. 'Added: Minor fixes.
  11. DIM background AS LONG
  12. _TITLE "Time and Date - (S)et Alarm"
  13. clock& = _NEWIMAGE(400, 200, 32)
  14. SCREEN clock&
  15. start:
  16. fontfile$ = "Lcd.ttf"
  17. style$ = "bold"
  18. f& = _LOADFONT(fontfile$, 72, style$)
  19. COLOR _RGB32(32, 64, 32), _RGB32(0, 0, 0, 10)
  20. _PRINTSTRING (10, 10), "88"
  21. _PRINTSTRING (95, 10), "88"
  22. _PRINTSTRING (180, 10), "88"
  23. _PRINTSTRING (320, 10), "88"
  24. _PRINTSTRING (10, 100), "88-88-8888"
  25. background& = _COPYIMAGE(0)
  26.     _LIMIT 50
  27.     _PUTIMAGE , background&
  28.     a$ = INKEY$
  29.     IF a$ = " " OR a$ = "s" OR a$ = "S" OR a$ = "a" OR a$ = "A" THEN GOSUB alarm:
  30.     t$ = TIME$
  31.     hour$ = LEFT$(t$, 2)
  32.     h = VAL(hour$)
  33.     IF h > 11 THEN pmam$ = " PM": ampm4 = 2
  34.     IF h < 12 THEN pmam$ = " AM": ampm4 = 1
  35.     IF h > 12 THEN h = h - 12: hour$ = STR$(h)
  36.     minute$ = MID$(t$, 4, 2)
  37.     m = VAL(minute$)
  38.     second$ = RIGHT$(t$, 2)
  39.     s = VAL(second$)
  40.     COLOR _RGB32(127, 255, 127), _RGB32(0, 0, 0, 10)
  41.     IF h > 9 THEN
  42.         sp5$ = " "
  43.     ELSE
  44.         sp5$ = ""
  45.     END IF
  46.     IF m > 9 AND m < 20 THEN
  47.         sp$ = " "
  48.     ELSE
  49.         sp$ = ""
  50.     END IF
  51.     IF s > 9 AND s < 20 THEN
  52.         sp2$ = " "
  53.     ELSE
  54.         sp2$ = ""
  55.     END IF
  56.     _PRINTSTRING (10, 10), sp5$ + hour$
  57.     _PRINTSTRING (80, 10), ":"
  58.     _PRINTSTRING (95, 10), sp$ + minute$
  59.     _PRINTSTRING (165, 10), ":"
  60.     _PRINTSTRING (180, 10), sp2$ + second$
  61.     _PRINTSTRING (300, 10), pmam$
  62.     d$ = DATE$
  63.     d = VAL(LEFT$(DATE$, 2))
  64.     IF d > 9 AND d < 20 THEN
  65.         sp3$ = " "
  66.     ELSE
  67.         sp3$ = ""
  68.     END IF
  69.     _PRINTSTRING (10, 100), sp3$ + d$
  70.     IF alarm = 1 THEN
  71.         month2$ = LEFT$(DATE$, 2)
  72.         month2 = VAL(month2$)
  73.         day2$ = MID$(DATE$, 4, 2)
  74.         day2 = VAL(day2$)
  75.         year2$ = RIGHT$(DATE$, 4)
  76.         year2 = VAL(year2$)
  77.         IF year = year2 AND month = month2 AND day = day2 AND h = hour2 AND m = minute2 AND s = second2 AND ampm3 = ampm4 THEN
  78.             DO
  79.                 FOR snd = 500 TO 600 STEP 20
  80.                     SOUND snd, .5
  81.                 NEXT snd
  82.                 _DELAY .25
  83.                 _TITLE "** Alarm ** Press Any Key To Stop"
  84.             LOOP UNTIL INKEY$ <> ""
  85.             alarm = 0
  86.             _TITLE "Time and Date - (S)et Alarm"
  87.             GOTO noalarm:
  88.         END IF
  89.     END IF
  90.     noalarm:
  91.     _DISPLAY
  92.     CLS
  93. LOOP UNTIL a$ = CHR$(27)
  94. alarm:
  95. _TITLE "Set Alarm Here"
  96. year:
  97. _FREEIMAGE background&
  98. INPUT "Year (example: 2020): ", year
  99. IF year < 2020 OR year <> INT(year) THEN GOTO year:
  100. month:
  101. INPUT "Month (1-12):", month
  102. IF month < 1 OR month > 12 OR month <> INT(month) THEN GOTO month:
  103. day:
  104. INPUT "Day (1-31): ", day
  105. IF day < 1 OR day > 31 OR day <> INT(day) THEN GOTO day:
  106. hour:
  107. INPUT "Hour (1-12): ", hour2
  108. IF hour2 < 1 OR hour2 > 12 OR hour2 <> INT(hour2) THEN GOTO hour:
  109. timeofday:
  110. INPUT "AM or PM: ", ampm2$
  111. IF LEFT$(ampm2$, 1) = "a" OR LEFT$(ampm2$, 1) = "A" THEN ampm3 = 1: GOTO minute:
  112. IF LEFT$(ampm2$, 1) = "p" OR LEFT$(ampm2$, 1) = "P" THEN ampm3 = 2: GOTO minute:
  113. GOTO timeofday:
  114. minute:
  115. INPUT "Minute (0-59): ", minute2
  116. IF minute2 < 0 OR minute2 > 59 OR minute2 <> INT(minute2) THEN GOTO minute:
  117. second:
  118. INPUT "Second (0-59): ", second2
  119. IF second2 < 0 OR second2 > 59 OR second2 <> INT(second2) THEN GOTO second:
  120. alarm = 1
  121. _TITLE "Time and Date - Alarm Set"
  122. GOTO start:
  123.  
« Last Edit: December 04, 2020, 07:26:36 pm by SierraKen »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: LCD Time and Date Using Windows Font
« Reply #22 on: December 04, 2020, 05:12:14 pm »
OK that did the trick versioning the mods really helps ID the zip. It could be my screw up I've been quite blunderful lately and I noticed two zips of same name in downloads I thought I deleted them before downloading next.

Anyway, the shadows do show up and almost work except its 5 something PM here and the 5 is placed between the shadows for the 2 eights. So if I were you, I wouldn't quit now...

The alignment is a little off when the double digits are fitting over the Eight Shadows. I will dig into code to see if I can help with alignment. For single digits times add 0's before the digit like this:

Hours = Right$("00" + _trim$(str$(hoursNumber)), 2)  'I hope that's right

It should put a zero before the 5 at 5 something PM.

Steve probably wrote up how to get things aligned above.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Vacuum Fluorescent Display (VCD) Alarm Clock Using LCD Font
« Reply #23 on: December 04, 2020, 06:27:01 pm »
B+, I made up the word "shadows" without explaining it in detail, and I apologize for that. I don't want the "shadows" to be the same as the numbers. What I did was make it look just like the old VFD (Vacuum Fluorescent Display) digits in old radios and digital clocks. It's where in daylight or light, you can see 8's underneath every digit. It's because it's how the numbers are brightened up. All they have are 8's to begin with, but not brightened until the certain lines of the 8's are brightened to form a different number. Here is a real life example of what I'm attempting with this program, in the picture below. I'm sorry for saying LCD in the posts above, someone corrected me saying they are VFD's instead.

Edit: I just uploaded the zip files again with the right VFD name. I'm not doing good today. lol I also renamed the forum thread.

Edit Again: You can tell my age now, this is the kind of stuff I grew up with.
 

Vacuum_fluorescent_1.jpg
* Vacuum_fluorescent_1.jpg (Filesize: 98.8 KB, Dimensions: 1567x820, Views: 193)
« Last Edit: December 04, 2020, 06:43:15 pm by SierraKen »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #24 on: December 04, 2020, 06:53:42 pm »
Ha! you can tell my age, I knew what you meant by shadow and kinda prefer that term or pre-image of every digit potential ;-) (as opposed to after image.) I looked up all those terms and said yeah, he's simulating VFD with a LCD font.

Did you try adding the 0 before single digits? That and using "Monospace" when load font might fix it all. Testing that next just in case you really do want to quit.

Maybe time to introduce Plasma Laser Appended Y Shadowing, PLAYS for short ;-))
« Last Edit: December 04, 2020, 06:58:13 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #25 on: December 04, 2020, 07:24:42 pm »
Thanks for pointing that out. I thought it was lined up better than it was. So I just fixed the hour and I added a zero on the month, because most likely it will need it when January comes around. If not, I'll repair it someday probably. I can't test it without changing my computer time and last time I did that I messed up Windows big time, so please don't test it like that. Hopefully it works. :)
Here is the updated zip, I added a 2 on the name at the end. I also deleted the other zips except for the first post on this thread, which I updated.

Edit: This zip has been removed, please keep scrolling for the best one. Thank you.

« Last Edit: December 04, 2020, 11:34:23 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #26 on: December 04, 2020, 07:33:12 pm »
Oh and I left the zero out of the hour display just so it looks better, in my point of view anyway. :) Instead I added a space.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #27 on: December 04, 2020, 07:33:25 pm »
Thanks for pointing that out. I thought it was lined up better than it was. So I just fixed the hour and I added a zero on the month, because most likely it will need it when January comes around. If not, I'll repair it someday probably. I can't test it without changing my computer time and last time I did that I messed up Windows big time, so please don't test it like that. Hopefully it works. :)
Here is the updated zip, I added a 2 on the name at the end. I also deleted the other zips except for the first post on this thread, which I updated.

Why would you need to mess with Windows time for testing?  You’re just testing a string value; make it anything you want.

Instead of d$ = DATE$, make d$ = “01/01/2021”, or whatever you want.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #28 on: December 04, 2020, 07:46:28 pm »
Thanks Steve. Does DATE$ add a zero automatically to a month before 10, like 09? This is becoming harder than I thought. but I'll figure it out soon. I'll be busy tonight though. I will have to break up date$ to months, days, and years like I did with the time, and place each one in the right spot.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #29 on: December 04, 2020, 07:52:45 pm »
The alignment problem is due to the font.

Code: QB64: [Select]
  1. DEFLNG A-Z
  2. _TITLE "Test Font load and width."
  3. SCREEN _NEWIMAGE(400, 200, 32)
  4.  
  5. f = _LOADFONT("Lcd.ttf", 60, "monospace")
  6.  
  7. 'PRINT _FONTWIDTH ' 15 for 30  and 165 for each of two 11 char strings, good!
  8.  
  9. COLOR &HFF252530, &H00000000
  10. _PRINTSTRING (10, 10), "88:88:88 PM"
  11. _PRINTSTRING (10, 10), "17:17:17 AM"
  12.  
  13.  

Ken coulda just used DATE$ and TIME$

Code: QB64: [Select]
  1. DEFLNG A-Z
  2. _TITLE "Test Font load and width."
  3. SCREEN _NEWIMAGE(400, 200, 32)
  4.  
  5. f = _LOADFONT("Lcd.ttf", 60, "monospace")
  6.  
  7. COLOR &HFF001530, &HFF000000
  8. _PRINTSTRING (10, 10), "88:88:88"
  9. _PRINTSTRING (10, 100), "88-88-8888"
  10. f = _NEWIMAGE(400, 200, 32)
  11. _PUTIMAGE , 0, f
  12. COLOR &HFFFF3300, &H00000000
  13.     _PUTIMAGE , f, 0
  14.     _PRINTSTRING (10, 10), TIME$
  15.     _PRINTSTRING (10, 100), DATE$
  16.     _DISPLAY
  17.     _LIMIT 10
  18.  
  19.  
« Last Edit: December 04, 2020, 08:04:41 pm by bplus »