Hey everyone!
I'm working with DBC, and I was wondering if someone could help me out. I have a small snippet of code that I'm using to test out an idea of mine. Its doing what I want it to do, but the text keep flashing, even with the SYNC code. What exactly am I doing wrong? I think I have the SYNC in the wrong spot, but I'm not sure.
If anyone has a chance, I'd also really appreciate advice on getting the code to run smoother. I'm sure I'm missing something that would make it more efficient since I'm just starting to program(just as a hobby). Any help is much appreciated!
Thanks, Calliah
EDIT I figured out why my screen was flashing like it was. I wasn't fully aware of what the SYNC command was for. I'm still a little shaky on it. Also, sorry about not posting the code in the brackets. I posted it under the code field below. Thought that was the right way to do it. Here is my code
`SYNC rate set
SYNC ON
SYNC RATE 60
`Declaring variables globally
speed=1
mspeed=10
speeda=0
mspeeda=0
`Main loop
DO
CLS
m=Speed(speed)
n=MSpeed(mspeed)
SET CURSOR 100,100
PRINT "Number 1: ",m
SET CURSOR 200,120
PRINT "Number 2: ", n
SYNC
LOOP
`Speed Function determines when to update the number according to the speed variable.
FUNCTION Speed(speed)
INC speeda
IF speeda=speed
INC m
SET CURSOR 100,100
PRINT "Number 1: ",m
speeda=0
ENDIF
ENDFUNCTION m
`MSpeed function uses the mspeed variable to determine when to updated the second number.
FUNCTION MSpeed(mspeed)
INC mspeeda
IF mspeeda=mspeed
INC n
SET CURSOR 200,120
PRINT "Number 2: ", n
mspeeda=0
ENDIF
ENDFUNCTION n