This is a very simple demo of the Raspberry Pi's GPIO being controlled by BBC BASIC, using the supplied 'gpiolib' library. It cycles through six of the outputs, setting each one high in sequence. The code is listed below, and this is the result (with LEDs fitted to monitor the outputs):
REM Initialise GPIO:
INSTALL @lib$ + "gpiolib"
GPIO% = FN_gpio_setup
REM Pin numbers to activate, in sequence:
DATA 17, 23, 25, 12, 16, 26
REM Set to input first:
RESTORE
FOR I% = 1 TO 6
READ pin%
PROC_gpio_inp(GPIO%, pin%)
NEXT
REM Set pins to output:
RESTORE
FOR I% = 1 TO 6
READ pin%
PROC_gpio_out(GPIO%, pin%)
NEXT
REM Cycle LEDs in sequence:
REPEAT
RESTORE
FOR I% = 1 TO 6
READ pin%
PROC_gpio_set(GPIO%, 2^pin%)
WAIT 20
PROC_gpio_clr(GPIO%, 2^pin%)
NEXT
UNTIL FALSE
END