I have a code which controls a robot arm as shown:
This code basically lets me press certain keys on the keyboard to move the arm. Unfortunately, the robot responds very slowly if I take out "SYSTEM". When i use SYSTEM, it exits the program regardless of the loop. I want the code to stay in the loop until i decide it to stop, so I thought about using CHAIN:
but the code doesn't work. I have a very premature understanding of qbasic and I've never really found a good documentation, so sorry if this problem is really basic. Anyone know of a solution?
Code:
10 K# = 0
20 DO
30 DO: A$ = INKEY$
40 LOOP UNTIL A$ <> ""
50 IF ASC(A$) = 68 THEN LPRINT "DW -10,0,0"
60 IF ASC(A$) = 65 THEN LPRINT "DW 10,0,0"
70 IF ASC(A$) = 87 THEN LPRINT "DW 0,10,0"
80 IF ASC(A$) = 83 THEN LPRINT "DW 0,-10,0"
90 IF ASC(A$) = 27 THEN K# = 1
95 SYSTEM
100 LOOP UNTIL K# <> 0
Code:
10 K# = 0
20 DO
30 DO: A$ = INKEY$
40 LOOP UNTIL A$ <> ""
50 CHAIN "move.bas"
90 IF ASC(A$) = 27 THEN K# = 1
100 LOOP UNTIL K# <> 0