top of page

Smart RGB LED Random Flashing

Smart RGB LED Random Flashing Program
This program has 6 WS2812B smart LEDs connected to port A
pin a1. It will cycle the LEDs through random colors.

Program


---

Smart LED Random Flashing Program

This program has 6 WS2812B smart LED's connected to port A

pin a1. It will cycle the LEDs through random colors.

---

prog_vars =

d/led_no 0

d/red 0

d/green 0

d/blue 0

prog_vars.


prog_start =

print "Smart LED Program Started"

-- turn all 6 leds off

sled a1 6 0 /red /green /blue

prog_start.


prog_loop =


-- Set each color to a random value

rand 0 255 -> /red

rand 0 255 -> /green

rand 0 255 -> /blue

-- Set the LEDs color

-- /led_no is the LED we are setting.

sled a1 6 /led_no /red /green /blue

-- Inc to the next LED and then start again.

any /led_no >= 6 ->

/led_no 0

else

inc /led_no

enda.

prog_loop.



prog_stop =

print "prog stopped"

prog_stop.



bottom of page