[vcf-midatlantic] GW-BASIC joystick programming

Evan Koblentz evan at vcfed.org
Sun Feb 18 13:44:37 EST 2018


How do I program joystick input in GW-BASIC?

It's insanely easy in Applesoft: you use the PDL(0) and PDL(1) commands 
to determine where the stick is located along X/Y (0-255 on each scale) 
and then tell it what do based on those locations.

For example, in Applesoft, my Lego robot navigation code looks like this:

3000 REM NEVIGATION
3010 FB=PDL (1):LR=PDL (0)
3020 IF FB < 75 THEN M=5
3030 IF FB > 180 THEN M=10
3040 IF LR < 75 THEN M=9
3050 IF LR > 180 THEN M=6
3060 POKE L,M: REM SEND COMMANDS

(The variable L is the address of the interface card to the control box. 
The variable M gets translated into binary to turn the relevant bits 
on/off at the control box, which runs the motors, sensors, and lights.)

How do I do this in GW?



More information about the vcf-midatlantic mailing list