This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
zaxaramas's profile picture

Lighting loop - Requires redpower lamps

Started by zaxaramas, 23 December 2012 - 07:01 AM
zaxaramas #1
Posted 23 December 2012 - 08:01 AM
I'm not the best at LUA but I thought someone might use this, its a lot longer than it could be, I am aware i could have made a function that did the long parts for me, but this one works.


while true do
print ("Activated...")
rs.setBundledOutput("bottom",1)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(.5)
rs.setBundledOutput("bottom",2)
sleep(.5)
rs.setBundledOutput("bottom",4)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(.5)
rs.setBundledOutput("bottom",8)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(.5)
rs.setBundledOutput("bottom",16)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(.5)
rs.setBundledOutput("bottom",32)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(.5)
rs.setBundledOutput("bottom",64)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(.5)
rs.setBundledOutput("bottom",128)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(.5)
rs.setBundledOutput("bottom",256)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(.5)
rs.setBundledOutput("bottom",512)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(.5)
rs.setBundledOutput("bottom",1024)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(.5)
rs.setBundledOutput("bottom",2048)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(.5)
rs.setBundledOutput("bottom",4096)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(.5)
rs.setBundledOutput("bottom",8192)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(.5)
rs.setBundledOutput("bottom",16384)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(.5)
rs.setBundledOutput("bottom",32768)
sleep(.5)
rs.setBundledOutput("bottom",0)
sleep(1)
rs.setBundledOutput("bottom",65535)
sleep(.5)
rs.setBundledOutput("bottom",0)
end

It lights up each colour of lamp, then turns it off again, with a half second delay between each one

Again, probably more compact ways to set up a computer to do this, but this is how i did it;
PixelToast #2
Posted 23 December 2012 - 08:26 AM
smaller version:

while true do
for i=0,15 do
sleep(0.5)
rs.setBundledOutput("bottom",0)
sleep(0.5)
rs.setBundledOutput("bottom",2^i)
end
end

also, you seem to be setting it to 65535
wich should error because the max is 2^15

and i dont get why this would require redpower lamps
it could work as a bundled cable tester
zaxaramas #3
Posted 23 December 2012 - 10:21 AM
smaller version:

while true do
for i=0,15 do
sleep(0.5)
rs.setBundledOutput("bottom",0)
sleep(0.5)
rs.setBundledOutput("bottom",2^i)
end
end

also, you seem to be setting it to 65535
wich should error because the max is 2^15

and i dont get why this would require redpower lamps
it could work as a bundled cable tester

65535 switches all the lamps on, it requires redpower to get any sort of feedback from it, other than no errors

Also, Thanks for the smaller code :)/>