A demo illustrating the use of graphicboxes and a bitmap to represent a binary clock.
This demo was inspired by a very impressive looking demo by Mike Bradbury, as featured in an article in issue 143 of the Liberty BASIC Newsletter. In the article, Mike does an excellent job explaining the usage of drawing a single bitmap with or without an offset repeatedly within a single graphicbox to simulate the switching of states of LEDs in order to represent binary output. This demo is very similar, except that it uses six graphicboxes oriented "vertically" (for each digit of hours, minutes, and seconds in a digital clock) instead of one horizontal, and the offset is along the x-axis. Save the image below into LB's "bmp" subdirectory as "blueLED.bmp", then copy and paste the code below into a new .BAS file. The program uses a timer to check at a specified interval (in milliseconds) whether the current time is different from the last displayed time and makes modifications as necessary, only redrawing the seconds, minutes, and/or hours if they've changed. Interestingly, this clock is more accurate than Windows XP's time picker; on both my test machines, BinClock showed an updated time a split second before XP did! Time is shown in 24-hour format, although the code could be easily modified to implement a 12-hour AM/PM format.
blueLED.bmp
greenLED2.bmp
Update: Mike Bradbury has given me permission to use the LED image he created. This LED looks more realistic, in my opinion. Thanks, Mike! In the code below, modify the 'led$' variable to reflect the name of this bitmap, and change 'BackgroundColor$' to "lightgray".
BinClock
A demo illustrating the use of graphicboxes and a bitmap to represent a binary clock.Update: Mike Bradbury has given me permission to use the LED image he created. This LED looks more realistic, in my opinion. Thanks, Mike! In the code below, modify the 'led$' variable to reflect the name of this bitmap, and change 'BackgroundColor$' to "lightgray".