Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- r = 255 --Starts at pure RED
- g = 0
- b = 0
- c = peripheral.wrap("top")
- t = 1
- while t == 1 do
- repeat --this loop goes 0-255 in Green
- form = string.format("%02x%02x%02x", r, g, b)
- sub = string.gsub(form, ", ", "")
- dec = tonumber(sub, 16)
- c.setColor(dec)
- g = g + 15
- sleep(.05)
- until g == 255
- repeat --this loop goes from 255-0 in Red
- form = string.format("%02x%02x%02x", r, g, b)
- sub = string.gsub(form, ", ", "")
- dec = tonumber(sub, 16)
- c.setColor(dec)
- r = r - 15
- sleep(.05)
- until r == 0
- repeat --this loop goes from 0-255 in Blue
- form = string.format("%02x%02x%02x", r, g, b)
- sub = string.gsub(form, ", ", "")
- dec = tonumber(sub, 16)
- c.setColor(dec)
- b = b + 15
- sleep(.05)
- until b == 255
- repeat --this loop goes from 255-0 in Green
- form = string.format("%02x%02x%02x", r, g, b)
- sub = string.gsub(form, ", ", "")
- dec = tonumber(sub, 16)
- c.setColor(dec)
- g = g - 15
- sleep(.05)
- until g == 0
- repeat --this loop goes from 0-255 in Red
- form = string.format("%02x%02x%02x", r, g, b)
- sub = string.gsub(form, ", ", "")
- dec = tonumber(sub, 16)
- c.setColor(dec)
- r = r + 15
- sleep(.05)
- until r == 255
- repeat --this loop goes from 255-0 in Blue
- form = string.format("%02x%02x%02x", r, g, b)
- sub = string.gsub(form, ", ", "")
- dec = tonumber(sub, 16)
- c.setColor(dec)
- b = b - 15
- sleep(.05)
- until b == 0
- end
Advertisement
Add Comment
Please, Sign In to add comment