Check out the supplied gpiolib.bbc library and the gpiodemo.bbc example program. Hopefully they should be fairly self-explanatory; the library includes some comments describing its use, the demo program is listed below:I'm a really novice in this and I'd like to ask how I could get control of GPIO ports, by using BBC Basic commands.
Code: Select all
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%, 1 << pin%)
WAIT 20
PROC_gpio_clr(GPIO%, 1 << pin%)
NEXT
UNTIL FALSE
END