An LED board |
![]() |
|
Above are photographs of the LED board connected to my interface
board and hence to the Raspberry pi. There is also a PCB layout. I
never made a circuit diagram. The power for the LEDs is connected to
the bottom of the board and the eight lines as well as V+ and 0V
conenect straight to the interface. A BBC BASIC program is below. It 'walks' an LED left
and right at different speeds and flashes all the LEDs, simply to show
that the system works. To control the GPIO pins you need a module
called 'GPIO' written by a talented fellow called Tank. I got my copy
from here: Tanks website
SYS"GPIO_EnableI2C",0 Switches the I2C pins to GPIOSYS"GPIO_ExpAsGPIO",2 switches all the expansion port pins into GPIO modes.
|
| REM
LED_Circus REM Fool around with some LEDs REM Jochen Lueg REM http://roevalley.com REM November 2012 REM Version 1.0 ON ERROR PRINT REPORT$;" at line: ";ERL:STOP PROCinit OSCLI"RMEnsure GPIO 0.00 RMLoad GPIO" OSCLI"RMEnsure GPIO 0.40 ERROR HELP can't find the GPIO module" SYS"GPIO_EnableI2C",0 SYS"GPIO_ExpAsGPIO",2 OFF VDU23,17,7,6,16;16;0;0; VDU 5 GCOL128 CLG GCOL 11 MOVE 0,2000 PRINT " Turn right . . . . . . R" PRINT " Turn left . . . . . . L" PRINT " Flash all . . . . . . F" PRINT " Random . . . . . . A" PRINT " Speeds . . . . . . 1 - 4" PRINT " Return to menu . . . . Spacebar" PRINT " Quit program . . . . . Q" REPEAT K$=INKEY$(0) IF K$="R" OR K$="r" PROCturn_right IF K$="L" OR K$="l" PROCturn_left IF K$="F" OR K$="f" PROCflash_all IF K$="A" OR K$="a" PROCrandom UNTIL K$="q" OR K$="Q" END DEFPROCflash_all LOCAL J% REPEAT FOR J% = 0 TO 7 SYS"GPIO_WriteData",LED%(J%),1 NEXT PROCwaste_time PROCclear_all PROCwaste_time UNTIL K$=" " PROCclear_all ENDPROC DEFPROCturn_right LOCAL J% REPEAT FOR J% = 0 TO 7 SYS"GPIO_WriteData",LED%(J%),1 PROCwaste_time PROCclear_all NEXT J% UNTIL K$=" " PROCclear_all ENDPROC DEFPROCturn_left LOCAL J% REPEAT FOR J% = 7 TO 1 STEP-1 SYS"GPIO_WriteData",LED%(J%),1 PROCwaste_time PROCclear_all NEXT J% UNTIL K$=" " PROCclear_all ENDPROC DEFPROCclear_all LOCAL J% FOR J%=0 TO 7 SYS"GPIO_WriteData",LED%(J%),0 NEXT ENDPROC DEFPROCwaste_time K$=INKEY$(Time%) IF K$="1" Time%=3 IF K$="2" Time%=5 IF K$="3" Time%=10 IF K$="4" Time%=20 ENDPROC DEFPROCrandom LOCAL N% REPEAT N%=RND(8) SYS"GPIO_WriteData",LED%(N%-1),1 PROCwaste_time PROCclear_all UNTIL K$=" " PROCclear_all ENDPROC DEFPROCinit W%=0 Time%=5 REM Rotation DIM LED%(7):LED%()=0,1,4,17,9,10,22,21 ENDPROC |
Visit Limavady and the Roe Valley
|