titaniumnitratecoatedcow
Member
my project involves variable b2 counting up to 4 and displaying b2's values ("1-4") on an LCD screen.
The value is displayed on the fist line, but when i try to display it on the second line i cant.
here is my code, thanks for any help.
The value is displayed on the fist line, but when i try to display it on the second line i cant.
here is my code, thanks for any help.
Code:
init:
b2=0
pause 500 ; wait for display to initialise
serout B.1,N2400,(254,1)
pause 30
main:
serout B.1,N2400,(254,128) ; move to start of first line
serout B.1,N2400,("places taken") ; output text
irout b.2, 1, 16 ; Send the command
pause 45 ; Pause after each command sent
readadc b.3,b1
debug
if b1 <50 then goto in_the_beam 'the car needs to be in the beam, but the exit the beam for b2 to count down,
'otherwise a car could sit in the beam for too long and cause multiple spaces to be displayed as taken.
'if b1 >50 then
goto main
in_the_beam:
readadc b.3,b1
pause 500
if b1 >50 then goto out_of_the_beam
goto in_the_beam
out_of_the_beam:
let b2 = b2 +1 ;the car is now out of the beam so display one less space as available (count up from 4)
if b1 < 50 then goto in_the_beam
serout b.1, n2400, ( 254, 128 ) 'second line
pause 500
serout b.1, N2400, (#b2)
if b2=4 then goto full 'stop b1 from counting up (maximum spaces taken up)
goto main
full:
let b2=4 'stop at 0=4
serout b.1, n2400, ( 254, 128 ) 'second line
serout b.1, n2400, ( b1,"park is full " )
Last edited by a moderator: