Page 1 of 1

automatic variable declaration in BASIC

Posted: Tue Feb 12, 2013 4:13 am
by YahooArchive
the code i have runs both subs every time. i have tried to use the

if lastx <> and the if x=0 statements and neither will make the sub change.
i can get the status of the pin to change on my display with no problem. what am
i overlooking in this code




DIM x$(10) as integer
DIM t$(10)
baud1=115200


DO
'wait(100)

TXD1=$7c
TXD1=$00

DIR(3)=0
x$ = AD (3)
x=IO(14)



if x = lastx then
else
x=(IO14)
if x <> lastx then
GOSUB PRINTSTR2
lastx = x
endif
endif
loop
PRINTSTR1:
I=0
WHILE x$(I)
TXD1 ( x$(I) )
I=I+1
LOOP
PRINTSTR2:
t$="button"
I=0
WHILE t$(I)
TXD1 (t$(I))
I=I+1
LOOP
wait(600)
return

any help is always appreciated

Re: automatic variable declaration in BASIC

Posted: Tue Feb 12, 2013 4:13 am
by YahooArchive
I think your statement 20 or so

x=(IO14)

should be

x=IO(14)

IO14 would be an undeclared variable with a value of 0