Page 1 of 1

Help me please

Posted: Fri Mar 27, 2009 5:40 pm
by QbasicBegginer
Good day to all..

I'm just wondering if anyone can help me with my problem about Qbasic..

My Teacher asked me to make a Wall Clock.. It's hard for me because
I'm just a beginner..

Anyone can help me? :(

Problem: There is a Circle that have a 1 - 12 numbers and a 2 line.. 1 is long and the other one is short.. If I put 5:00, the short line must be in 5 and the long one will go in 12..

Pls help me :(

Posted: Fri Mar 27, 2009 6:56 pm
by burger2227
Post what you have coded so far! We cannot write the code for you, but we can point out problems.

And forget that PINK lettering, please. I'm blind enough........

Ted

Posted: Sat Mar 28, 2009 5:22 pm
by QbasicBegginer
oh.. sorry for the font color Sir Ted :)

By the way.. I am researching in Internet and I found this link:

http://www.luberth.com/5x7-5x8.bas

----------------------------------------------------------------------------------------
'Andijk 3-10-1997
'this basic program i use for 5x7 or 5x8 LED Dot Matrix fonts
'it shows the hex valeu
'so it makes it easier to change the font on the propellor clock
'Luberth

DECLARE SUB EditPattern ()
DECLARE SUB Initialize ()
DECLARE SUB ShowPattern ()
DIM Bit%(0 TO 7), Pattern$, Esc$

Initialize
EditPattern

END

'
SUB EditPattern STATIC
SHARED Pattern$, Esc$, Bit%()
ByteNum% = 1 'Starting position.
Bitnum% = 0
Null$ = CHR$(0) 'CHR$(0) is the first byte of the
'two-byte string returned when a
'direction key such as UP or DOWN is
'pressed.
DO
ShowPattern
X% = ((ByteNum%) * 16) + 234
Y% = 30 + (Bitnum% - 10) * -8

State% = 0
RefTime = 0

DO
IF ABS(TIMER - RefTime) > .3 THEN
RefTime = TIMER
State% = 2 - State%
'Turn the border of bit on and off:
LINE (X% - 1, Y% - 1)-STEP(15, 8), State%, B
END IF
Check$ = INKEY$

LOOP WHILE Check$ = ""


LINE (X% - 1, Y% - 1)-STEP(15, 8), 0, B

SELECT CASE Check$

CASE CHR$(27)
EXIT SUB

CASE CHR$(32)

CurrentByte% = ASC(MID$(Pattern$, ByteNum%, 1))
CurrentByte% = CurrentByte% XOR Bit%(Bitnum%)
MID$(Pattern$, ByteNum%) = CHR$(CurrentByte%)

IF (CurrentByte% AND Bit%(Bitnum%)) <> 0 THEN

CurrentColor% = 0
ELSE CurrentColor% = 2

END IF


LINE (X% + 1, Y% + 1)-STEP(11, 4), CurrentColor%, BF

CASE Null$ + CHR$(75)
ByteNum% = ByteNum% - 1
IF ByteNum% <1> 5 THEN ByteNum% = 1

CASE Null$ + CHR$(72)
Bitnum% = Bitnum% + 1
IF Bitnum% > 7 THEN Bitnum% = 0

CASE Null$ + CHR$(80)
Bitnum% = Bitnum% - 1
IF Bitnum% < 0 THEN Bitnum% = 7

CASE ELSE


END SELECT
LOOP
END SUB

'
SUB Initialize STATIC
SHARED Pattern$, Esc$, Bit%()

Esc$ = CHR$(27)

FOR I% = 0 TO 7: Bit%(I%) = 2 ^ I%: PRINT Bit%(I%): NEXT I%

Pattern$ = STRING$(8, 255)

SCREEN 8: CLS

FOR a = 1 TO 8
X% = 250: Y% = 30 + (a + 2) * 8
FOR J% = 1 TO 5
LINE (X%, Y%)-STEP(13, 6), 8, B
X% = X% + 16
NEXT J%
NEXT a

LOCATE 19, 20: PRINT "DIRECTION keys........Move cursor"
LOCATE 20, 20: PRINT "SPACEBAR............Changes point"
LOCATE 21, 20: PRINT "ESC.........................Quits";
LOCATE 23, 5: PRINT "Luberth@worldaccess.nl www.worldaccess.nl/~luberth"
END SUB

'
SUB ShowPattern
SHARED Pattern$

LOCATE 1, 15: PRINT "The following characters make up your pattern:"

a = 5

FOR I% = 1 TO 5
PatternByte% = ASC(MID$(Pattern$, I%, 1))
LOCATE 15, 45: PRINT "Hex: "
LOCATE 15, 45 + a: PRINT " "
LOCATE 15, 45 + a: PRINT HEX$(PatternByte%)
B$ = HEX$(PatternByte%)
a = a + 4
NEXT I%

END SUB

------------------------------------------------------------------------------------

but when I try to encode it to Qbasic there is always an error :(

I need to pass this Project in Monday :(

Posted: Sat Mar 28, 2009 9:20 pm
by burger2227
Not sure if you pasted it correctly. There are 2 LINE statements that need

Code: Select all

 STEP(15, 8), instead of the smiley faces Lol. (the number went missing) 

Always use the code option before and slash code at the end of posted code!

Also you missed CASE Null$ + CHR$(77). I ran the code fine after the edits.

I don't see how that will become a clock, but I have seen some strange ideas turn out pretty interesting. Where is your code? Also include the errors you are getting. Good luck!

Ted

Posted: Sun Mar 29, 2009 6:45 pm
by QbasicBegginer
Thank you for supporting me Sir Ted :)

http://www.luberth.com/5x7-5x8.bas

Open the link Sir. I found the code that i posted last time in that link.

I'm not really good in Qbasic hehe I don't really understand some codes.

Can you help me to encode it?

Another question Sir. Do i have to put ' ?

Example:

'
SUB EditPattern STATIC
SHARED Pattern$, Esc$, Bit%()
ByteNum% = 1
Bitnum% = 0
Null$ = CHR$(0)

Thank you Sir Ted for answering my question :)