Posted 28 August 2013 - 10:15 PM
I am trying to write a program where 6 different monitors connected with wired modems and network cable, with only one modem on computer. Where they all flash semi simultaneously red and black for 60 seconds. I pieced this code together in my research. Its not written for the full run time(would love something simpler than repeating color/clear commands) for testing. But currently it sends the colors to all monitors but only one monitor at a time then moves to the next then the next. I would like it to send it to all at once, what am I doing wrong? Any help is greatly appreciated
local function getPeripherals(sType)
local t = {}
for _,name in ipairs(peripheral.getNames()) do
if peripheral.getType(name) == sType then
t[#t + 1] = peripheral.wrap(name)
end
end
return t
end
local t = getPeripherals("monitor")
for i = 1, #t do
t.setBackgroundColor(colors.red)
t.clear()
sleep(0.5)
t.setBackgroundColor(colors.black)
t.clear()
sleep(0.5)
t.setBackgroundColor(colors.red)
t.clear()
sleep(0.5)
t.setBackgroundColor(colors.black)
t.clear()
sleep(0.5)
t.setBackgroundColor(colors.red)
t.clear()
sleep(0.5)
t.setBackgroundColor(colors.black)
t.clear()
sleep(0.5)
end