2. Moving the stick left or right does nothing. That's by design. As I said I'm going to take a break from this project for a while. Later I might make L/R movement do what buttons 0/1 do now.
Okay so I lied. :) It occurred to me that changing the button control to joystick left/right is as easy as changing line 310 from this:
310 IF PEEK (49249)>127 THEN GOTO 400
To this:
310 IF LR<75 THEN GOTO 400
And line 320 from this:
320 IF PEEK (49250)>127 THEN GOTO 440
To this:
320 IF LR>180 THEN GOTO 440
And line 420 from this:
420 IF PEEK (49249)>127 THEN GOTO 410
To this:
420 IF LR<75 THEN GOTO 410
And line 460 from this:
IF PEEK (49250)>127 THEN GOTO 450
To this:
IF LR>180 THEN GOTO 450
That should work, right? Direct swap of the button code to the joystick left/right code. But it doesn't work. Not even close. I made a ROBOT2 file, changed that code, and it basically goes berzerk. Motors come on as soon as I run the program, moving the stick caused all kinds of conflicts, etc. Why didn't it work? What am I missing?
--------------------------------
10 REM INIT LEGO 20 GOSUB 1000 30 M=49344 40 POKE M,0: REM MOTORS OFF 100 REM LISTEN TO JOYSTICK 110 FB= PDL (1) 120 LR=PDL (0) 200 REM STRAIGHT 210 IF FB>75 AND FB<180 THEN POKE M,0 220 IF FB<75 THEN POKE M,5 230 IF FB>180 THEN POKE M,10 300 REM TURNING 310 IF PEEK (49249)>127 THEN GOTO 400 320 IF PEEK (49250)>127 THEN GOTO 440 330 GOTO 100 340 END 400 POKE M,0 410 POKE M,9 420 IF PEEK (49249)>127 THEN GOTO 410 430 GOTO 100 440 POKE M,0 450 POKE M,6 460 IF PEEK (49250)>127 THEN GOTO 450 470 GOTO 100 1000 REM INIT 1001 S=4:L=49280+S*16 1002 POKE L+3,1 1003 POKE L+2,63 1004 POKE L+1,0 1005 POKE L,0 1006 RETURN