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

0 Members and 1 Guest are viewing this topic.

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 #30 on: December 04, 2020, 07:57:29 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.

https://www.qb64.org/wiki/DATE$

Returns the current computer date in the format "mm-dd-yyyy" (e.g., "12-25-2009").

Leading 0’s are included, so you see dates like 06-02-2020.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #31 on: December 04, 2020, 08:08:37 pm »
Now it is like a shadow!
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 (6, 6), TIME$
  15.     _PRINTSTRING (6, 96), DATE$
  16.     _DISPLAY
  17.     _LIMIT 10
  18.  

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #32 on: December 04, 2020, 08:24:25 pm »
Awesome, thanks again Steve, that will help me tons.
LOLOL B+, somehow I had a feeling you would jump in, well especially being Friday. :D
I'll work on this more this weekend and see what I can come up with.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #33 on: December 04, 2020, 08:29:30 pm »
@SierraKen

I don't know if you saw my last post on page 2 but the alignment problem is with the font and how it was made, no fixing that but Richard Frost has a great segment code for digits I could dig it up, oh yeah I saw his and made my own.

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 #34 on: December 04, 2020, 08:32:57 pm »
@SierraKen

I don't know if you saw my last post on page 2 but the alignment problem is with the font and how it was made, no fixing that but Richard Frost has a great segment code for digits I could dig it up, oh yeah I saw his and made my own.

Easy solution: swap to a monospaced font: https://www.1001fonts.com/monospaced+lcd-fonts.html

Digital-7 +3 looks promising.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #35 on: December 04, 2020, 08:38:26 pm »
Yeah -7 +3 should do it, or grow your own:
Code: QB64: [Select]
  1. _TITLE "Plasmatic Digital Clock 3" ' b+ 2020-01-21 modified:
  2. ' Digital Plasmatic Clock b+ 2020-01-20 translated and modified from SmallBASIC
  3. ' Plasma Magnifico - updated 2015-11-26 for Android
  4. ' This program creates a plasma surface, which looks oily or silky.
  5.  
  6. '=====================================================================================================
  7. '
  8. '       Use spacebar to change color set, + to increase clock size and - to decrease clock size
  9. '
  10. '=====================================================================================================
  11.  
  12. CONST dat = "1110111000001101111100011111100101110111011111101001001111111111011011"
  13. TYPE xy
  14.     x AS SINGLE
  15.     y AS SINGLE
  16.     dx AS SINGLE
  17.     dy AS SINGLE
  18. DIM SHARED sq, xmax, ymax
  19. sq = 15: xmax = 34 * sq: ymax = 8 * sq
  20. SCREEN _NEWIMAGE(xmax, ymax, 32)
  21. DIM c(360) AS _UNSIGNED LONG, p(6) AS xy, f(6), clr AS _UNSIGNED LONG
  22. restart:
  23. r = RND: g = RND: b = RND: i = 0
  24. FOR n = 1 TO 5
  25.     r1 = r: g1 = g: b1 = b
  26.     DO: r = RND: LOOP UNTIL ABS(r - r1) > .2
  27.     DO: g = RND: LOOP UNTIL ABS(g - g1) > .2
  28.     DO: b = RND: LOOP UNTIL ABS(g - g1) > .2
  29.     FOR m = 0 TO 17: m1 = 17 - m
  30.         f1 = (m * r) / 18: f2 = (m * g) / 18: f3 = (m * b) / 18: c(i) = rgbf(f1, f2, f3): i = i + 1
  31.     NEXT
  32.     FOR m = 0 TO 17: m1 = 17 - m
  33.         f1 = (m + m1 * r) / 18: f2 = (m + m1 * g) / 18: f3 = (m + m1 * b) / 18: c(i) = rgbf(f1, f2, f3): i = i + 1
  34.     NEXT
  35.     FOR m = 0 TO 17: m1 = 17 - m
  36.         f1 = (m1 + m * r) / 18: f2 = (m1 + m * g) / 18: f3 = (m1 + m * b) / 18: c(i) = rgbf(f1, f2, f3): i = i + 1
  37.     NEXT
  38.     FOR m = 0 TO 17: m1 = 17 - m
  39.         f1 = (m1 * r) / 18: f2 = (m1 * g) / 18: f3 = (m1 * b) / 18: c(i) = rgbf(f1, f2, f3): i = i + 1
  40.     NEXT
  41.  
  42. FOR n = 0 TO 5
  43.     p(n).x = RND * xmax: p(n).y = RND * ymax: p(n).dx = RND * 2 - 1: p(n).dy = RND * 2 - 1
  44.     f(n) = RND * .1
  45.  
  46. WHILE _KEYDOWN(27) = 0
  47.     k$ = INKEY$
  48.     IF k$ = " " THEN GOTO restart
  49.     IF k$ = "+" AND sq < 40 THEN sq = sq + 1: xmax = 34 * sq: ymax = 8 * sq: SCREEN _NEWIMAGE(xmax, ymax, 32): GOTO restart
  50.     IF k$ = "-" AND sq > 3 THEN sq = sq - 1: xmax = 34 * sq: ymax = 8 * sq: SCREEN _NEWIMAGE(xmax, ymax, 32): GOTO restart
  51.     FOR i = 0 TO 5
  52.         p(i).x = p(i).x + p(i).dx
  53.         IF p(i).x > xmax OR p(i).x < 0 THEN p(i).dx = -p(i).dx
  54.         p(i).y = p(i).y + p(i).dy
  55.         IF p(i).y > ymax OR p(i).y < 0 THEN p(i).dy = -p(i).dy
  56.     NEXT
  57.     FOR y = 0 TO ymax - 1 STEP 2
  58.         FOR x = 0 TO xmax - 1 STEP 2
  59.             d = 0
  60.             FOR n = 0 TO 5
  61.                 dx = x - p(n).x: dy = y - p(n).y
  62.                 k = SQR(dx * dx + dy * dy)
  63.                 d = d + (SIN(k * f(n)) + 1) / 2
  64.             NEXT n: d = d * 60
  65.             LINE (x, y)-STEP(2, 2), c(d), BF
  66.         NEXT
  67.     NEXT
  68.     FOR n = 1 TO 8 'clock digits over background
  69.         IF MID$(TIME$, n, 1) = ":" THEN
  70.             FOR i = .5 * sq TO 0 STEP -.25
  71.                 clr = _RGBA32(255 - i * (255 / sq), (.5 * sq - i) * 255 / sq, 0, 380 / sq)
  72.                 LINE ((n - 1) * 4 * sq + 2 * sq + .5 * sq - i, sq + sq + .5 * sq - i)-STEP(2 * i, 2 * i), clr, BF
  73.                 LINE ((n - 1) * 4 * sq + 2 * sq + .5 * sq - i, 5 * sq + .5 * sq - i)-STEP(2 * i, 2 * i), clr, BF
  74.             NEXT
  75.         ELSE
  76.             drawC (n - 1) * 4 * sq + sq + offset, sq + offset, MID$(dat$, VAL(MID$(TIME$, n, 1)) * 7 + 1, 7)
  77.         END IF
  78.     NEXT
  79.     _LIMIT 60
  80.     _DISPLAY
  81.  
  82. FUNCTION rgbf~& (n1, n2, n3)
  83.     rgbf~& = _RGB32(n1 * 80, n2 * 80, n3 * 80)
  84.  
  85. SUB drawC (x, y, c$)
  86.     FOR m = 1 TO 7
  87.         IF VAL(MID$(c$, m, 1)) THEN
  88.             FOR i = .5 * sq TO 0 STEP -.25
  89.                 c = _RGBA32(255 - i * (255 / sq), (.5 * sq - i) * 255 / sq, 0, 380 / sq)
  90.                 SELECT CASE m
  91.                     CASE 1: LINE (x + .5 * sq - i, y + .5 * sq + i)-(x + .5 * sq + i, y + 2.5 * sq - i), c, BF
  92.                     CASE 2: LINE (x + .5 * sq - i, y + 2.5 * sq + i)-(x + .5 * sq + i, y + 5.5 * sq - i), c, BF
  93.                     CASE 3: LINE (x + .5 * sq + i, y + .5 * sq + i)-(x + 2.5 * sq - 2 - i, y + .5 * sq - i), c, BF
  94.                     CASE 4: LINE (x + .5 * sq + i, y + 2.5 * sq + i)-(x + 2.5 * sq - 2 - i, y + 2.5 * sq - i), c, BF
  95.                     CASE 5: LINE (x + .5 * sq + i, y + 5.5 * sq + i)-(x + 2.5 * sq - 2 - i, y + 5.5 * sq - i), c, BF
  96.                     CASE 6: LINE (x + 2.5 * sq - i, y + .5 * sq + i)-(x + 2.5 * sq + i, y + 2.5 * sq - i), c, BF
  97.                     CASE 7: LINE (x + 2.5 * sq - i, y + 2.5 * sq + i)-(x + 2.5 * sq + i, y + 5.5 * sq - i), c, BF
  98.                 END SELECT
  99.             NEXT
  100.         END IF
  101.     NEXT
  102.  
  103.  
  104.  
  105.  

EDIT: update just darkened the background

I know you probably don't want to do this but it's cool!
« Last Edit: December 04, 2020, 08:44:11 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #36 on: December 04, 2020, 11:31:01 pm »
I tried that font that Steve found but it would only show the top half of the fonts for some reason. I even tried it on a test program which only loaded the font and some words. So I looked online and found another website of LCD-type fonts and after trying a few of them, I found the perfect one. :)) I am 100% finished now I believe. I'll update the zip file on the first post and post it on this one. It has a 3 at the end of the zip filename. It includes the new font. I also lined up the date better so it's more in the middle. Please check it out, I'm really happy about this one. :) I'll put a picture of it below too. Thanks for your help everyone, tell me what you think of this one. I added thank-you's to the code on top.

Edit: Zip file removed, please keep scrolling down to the next one.
Time and Date VFD by SierraKen.jpg
* Time and Date VFD by SierraKen.jpg (Filesize: 38.29 KB, Dimensions: 500x227, Views: 203)
« Last Edit: December 05, 2020, 01:27:28 am by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #37 on: December 04, 2020, 11:48:32 pm »
What I did was just use the MONOSPACE font and that meant I could delete all the unnecessary spaces, etc. In fact, I didn't have to take apart the DATE$ after all (well besides the alarm of course)! And the only reason I had to take apart the TIME$ was to convert it to a 12 hour clock and alarm. :)) I also made the alarm sound a little bit better. Lots to learn in this project. I hope many people can do the same. :)
« Last Edit: December 04, 2020, 11:50:24 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 #38 on: December 05, 2020, 12:06:28 am »
Hi @SierraKen

Looks like you found a font that works for your purposes, I just tried code and you need to _TRIM$(STR$(h))
Code: QB64: [Select]
  1. IF h > 12 THEN h = h - 12: hour$ = STR$(h)    

because I am trying code at 11+PM and the time on top line is one space over to right.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #39 on: December 05, 2020, 12:16:25 am »
B+, you might be seeing that the "1" is in the middle of the 8 instead of on either side, and that is how it's supposed to be. Here is a picture of what I see when I set the hour$ = "11". Tell me if I'm wrong and I will try to fix it. Sorry for not mentioning the difference in where the "1"'s are located. The fonts just put them directly in the center. And to me that is fine. In fact I remember clocks from back then that were like this.

clock-11.jpg
* clock-11.jpg (Filesize: 35.19 KB, Dimensions: 499x221, Views: 192)
« Last Edit: December 05, 2020, 12:18:28 am by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #40 on: December 05, 2020, 01:13:51 am »
Oh gee, now I see what you meant B+, sorry again. :(
I'll try to do what you said and use that command to try and fix it. Thank you.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #41 on: December 05, 2020, 01:24:58 am »
Here is the Hour fix using _TRIM$. It seems to work now fine. It's still under "beta" and will be tested more soon.
But here is (hopefully) the last version. Thanks again B+.

Edit: Deleted zip again, I put the code on the wrong line. LOLOL Today is like "impossible day" for programming for me, but I worked through it all. I'll post the newest update on the next post.


« Last Edit: December 05, 2020, 01:35:56 am by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #42 on: December 05, 2020, 01:37:35 am »
Here, hopefully, is the very last update. It's still under beta, so I will keep testing it tomorrow, etc. But it should work fine now, hopefully.

Edit: Zip file deleted, please go to the next forum page for the fixed version. I apologize for all these versions.

« Last Edit: December 05, 2020, 04:38:48 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 #43 on: December 05, 2020, 09:33:22 am »
Confirmed the Digit 7 font was only printing the top half of numbers, the site at Steve's link also had a font called Crashed Score and was exactly the shadow and digit effect you want but:
1. The shadow was same brightness level and color as the printed digit which makes me think why bother?
2. You'd have to skip colons because they were awful! but  you could paint the clock face with colons or 2 dots (filled circle)  but that does NOT fix problem 1.

Meanwhile I started on a digit font that you can control height and color mod from the plasma clock demo, maybe you could use that instead of font or I could use for something later or someone maybe Richard Frost might like. I figured finally where the numbers 7 and 3 applied, 7 segments 3 or which are horizontal. Drawing font instead of printing allows changing colors in the image allowing the effect of being lit up or neon effect among other things

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
« Reply #44 on: December 05, 2020, 12:52:11 pm »
LOL I almost freaked out again. I ran it first thing this morning and it did the same thing as last night before it was fixed. So I opened it with QB64 and tried it and it worked fine LOL. My Windows Shortcut was looking at an older .exe because last night QB64 made a <name> (2).exe on accident LOL. So everything works right on lining up with both AM and PM numbers, etc. I believe. Thanks again for your help B+. As for your new fonts you are making, I might try them out, they sound interesting. Oh also, I don't think it matters what kind of font you use (as long as they work) to change the color brightness on them since I did that on a few different fonts using the COLOR command. To make a darker shade of green, I just had to divide each of the RGB colors by 4 (or so) and it just made a darker green. Of course I could have also just used the color slider (why am I always doing things the hard way? LOL) But yeah, if you could draw the font straight to the program, you could use neon. I actually thought of that a few days ago but remembered that it wouldn't work with a regular font file.