[REBOL] Re: changing color of LED
From: SunandaDH:aol at: 2-Jan-2004 15:42
Hi Rene:
> Therefore I used leds (indicator lights) with the colors red and green.
> After purging old stuff from my disc I lost this reblet, too. So I can't
> remember how I did changed the color of single leds.
Two functions and a demo:
Flip-LED: func [led [object!]]
[
led/data: not led/data
show led
]
change-led: func [led [object!] color1 [tuple!] color2 [tuple!]]
[
led/colors: reduce [color1 color2]
led/data: true
Show led
]
unview/all
view layout [
l1: led
button "flicker" [
loop 5 [wait (random 10) / 100
Flip-LED l1
]
]
button "change colors" [
change-led l1 random/secure 255.255.255
random/secure 128.128.128
]
]
Sunanda<