SHOW:
|
|
- or go back to the newest paste.
| 1 | - | r = 255 --Starts at pure RED |
| 1 | + | --This program asks for RGB values and sets a Glowstone Illuminator, that placed on top of the computer, to the color entered. It keeps setting the color every 1.5 seconds until terminated. This way you don't have to keep entering values and can change the color of a bunch at once. |
| 2 | ||
| 3 | r = 0 | |
| 4 | g = 0 | |
| 5 | b = 0 | |
| 6 | c = peripheral.wrap("top")
| |
| 7 | - | repeat --this loop goes 0-255 in Green |
| 7 | + | |
| 8 | ||
| 9 | term.clear() | |
| 10 | term.setCursorPos(1,1) | |
| 11 | ||
| 12 | - | c.setColor(dec) |
| 12 | + | print("Enter RED value (0-255): ")
|
| 13 | r = tonumber(read()) | |
| 14 | - | g = g + 1 |
| 14 | + | |
| 15 | print("Enter GREEN value (0-255): ")
| |
| 16 | - | sleep(.1) |
| 16 | + | g = tonumber(read()) |
| 17 | - | until g == 255 |
| 17 | + | |
| 18 | print("Enter BLUE value (0-255): ")
| |
| 19 | b = tonumber(read()) | |
| 20 | ||
| 21 | ||
| 22 | - | repeat --this loop goes from 255-0 in Red |
| 22 | + | |
| 23 | sub = string.gsub(form, ", ", "") | |
| 24 | dec = tonumber(sub, 16) | |
| 25 | ||
| 26 | while true do | |
| 27 | - | c.setColor(dec) |
| 27 | + | c.setColor(dec) |
| 28 | sleep(1.5) | |
| 29 | - | r = r - 1 |
| 29 | + | end |
| 30 | ||
| 31 | - | sleep(.1) |
| 31 | + | |
| 32 | - | until r == 0 |
| 32 | + | |
| 33 | ||
| 34 | ||
| 35 | ||
| 36 | ||
| 37 | - | repeat --this loop goes from 0-255 in Blue |
| 37 | + | |
| 38 | ||
| 39 |