Code:
starthere:
IF gpio.3 = 1 THEN GOTO main
GOTO starthere
'------------------------------------flash them all to make it look cool
main:
FOR i = 1 TO 20
RANDOM myword
mybyte = (myword//20)
IF previous_random = mybyte THEN GOTO main
GOSUB high_led
PAUSE delay
gpio = %000000
PAUSE delay
previous_random = mybyte
NEXT i
gpio = 0
trisio = %111111
' ----------------------------------------------------send it back to nap
GOTO starthere
high_led:
LOOKUP mybyte,[%000001,%000010,%000001,%000100,%000001,%010000,%000001,%100000,%000010,%000100,%000010,%010000,%000010,%100000,%000100,%010000,%000100,%100000,%010000,%100000],gpiostate
gpio = gpiostate
LOOKUP mybyte,[%111100,%111100,%111010,%111010,%101110,%101110,%011110,%011110,%111001,%111001,%101101,%101101,%011101,%011101,%101011,%101011,%011011,%011011,%001111,%001111],tristate
trisio = tristate
RETURN
END
I cut this out of a program I was using to control 20 LEDs so you'd have to modify the table to suit your needs.
Bookmarks