Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sqrt, sin, cos, min, max = math.sqrt, math.sin, math.cos, math.min, math.max
- local pi = math.pi
- local r1, r2 = 0 , 1.0
- local g1, g2 = -sqrt( 3 )/2, -0.5
- local b1, b2 = sqrt( 3 )/2, -0.5
- --[[--
- @param h a real number between 0 and 2*pi
- @param s a real number between 0 and 1
- @param v a real number between 0 and 1
- ]]
- local function HSVToRGB( h, s, v, a )
- h=h+pi/2--because the r vector is up
- local r, g, b = 1, 1, 1
- local h1, h2 = cos( h ), sin( h )
- --hue
- r = h1*r1 + h2*r2
- g = h1*g1 + h2*g2
- b = h1*b1 + h2*b2
- --saturation
- r = r + (1-r)*s
- g = g + (1-g)*s
- b = b + (1-b)*s
- r,g,b = r*v, g*v, b*v
- return r*255, g*255, b*255, (a or 1) * 255
- end
- leds = {"ac6767a7-ef2d-4d70-b75b-67df15ee9df3",
- "c42270e2-9c4a-4548-b31f-c52283f01d80",
- "7977b69d-eb8e-49fc-b516-d4c27e04503b",
- "2e495282-9f8a-4d6f-9a0f-4ce389ec9128",
- "0da594b9-9451-4403-ae4d-6280cb9dd554",
- "eccdcd3e-1762-49c9-b5b7-90e36379e389",
- "6ce9f65d-fcf9-4134-9b9b-aff4144ab756",
- "563f48b1-8535-4d40-bb9d-1fdd3e93d3cf",
- "819b3b65-6e08-435b-bf20-8553cd17cb10",
- "90bf44e6-3db2-46ac-8e33-7892e7ccd4d4",
- "9feddb9e-53b9-43de-9971-84e8f376e4ba",
- "6b2075a7-ee5d-4d86-9233-1ce475a7c99b",
- "87920cea-22ab-47cd-af45-0a29f2b2d740",
- "6e34479e-0c3d-4b75-9188-59deddcb622e",
- "12752ad0-5416-4a6a-a414-ddb2d8434539",
- "9022ba96-2c00-45d8-a243-46d434b894be",
- "b967ae48-b773-497b-99f4-419d65b47d63",
- "f8c5dea1-53cf-48a8-bbdd-a9e34e572496",
- "74459330-612e-4e87-bc8c-16cd23dab458",
- "0325ec1b-69dc-4dee-a982-1e70f94d05a2",
- "b6ea610f-399d-4fe1-85da-5ed91fdcba18",
- "8e09b263-bafa-4ab1-8229-77a829f84c16",
- "8b2ba438-396d-4e75-8565-ea8d5da5a5f3",
- "1797bd79-6fdc-4d9c-9cb3-9be89b6fca61",
- "e1998592-408f-4df0-b267-2ae1a514c9ff",
- "6728ff26-238b-4e83-abc9-c5d037bbfa9c",
- "870a7c9a-0a8d-4176-9b2a-5643e549810a",
- "51cec127-3bad-416d-8e9a-034dea471ff5",
- "c0185d2d-fad9-4841-a70d-076626816608",
- "3d3a50e8-0550-4225-ad26-726ed59f5a6c",
- "17164db8-7d98-43cf-a9c5-295b025da7b5",
- "ecb8f1a0-2f3e-46ed-90e7-49ac353fad2e",
- "d89797fc-4362-4852-a825-08ff614294ec",
- "81075c82-d61b-4dcb-b0d1-c1d74505702b",
- "c2d81f51-4b8d-44b2-a4af-d406d78c91dc",
- "ea473aaa-0bad-4a50-8b53-ea8b45b1052f",
- "857a0213-2f87-4c6a-820c-e36f9957f8a1",
- "5369c9e9-c962-46be-9bcd-ea1476cf5eb8",
- "14b75fa6-7f2b-4e08-9832-c7d83847d06b",
- "baf88cb5-4e77-4be1-a637-87de23bc852d"}
- local component = require("component")
- local bit32 = require("bit32")
- i = 0
- while true do
- i = i + 1
- if i == 320 then
- i = 0
- end
- for b = 1,40 do
- r,g,ba = HSVtoRGB(i + (b-1),1,1)
- r = math.floor(r * 31)
- g = math.floor(g * 31)
- ba = math.floor(b * 31)
- rgb = (bit32.lshift(r,10) + bit32.lshift(g,5) + ba)
- local proxy = component.proxy(leds[b])
- proxy.setLampColor(rgb)
- end
- os.sleep(10);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement