Posted 10 May 2017 - 03:29 PM
So, I'm trying to create my own script to use the monitor as a traffic light. The traffic light uses a proximity sensor to detect a player and change the screen background from red to green. I'm not at my computer to show you all of what I have done, but I really need help.(I am a NOOB at this. No knowledge at all, and very new to Lua and Computercraft. Opencomputers is way too complicated to me but I think both CC and OpenComp are very cool.) This is why I am trying to create something simple, but that doesn't seem to work.
I can try to replicate what I did:
m = peripheral.wrap("back")
while true do <—-(to loop)
if rs.getInput("top") then <—–(to grab redstone signal)
m.setBackgroundColor(colors.green)
else
m.clear()
m.setBackgroundColor(colors.red)
m.clear()
end
Sorry about the blank spots, once I get home I'll look at what I did and add it here. So, basically, I want the background color to change green when Redstone is detected, and red when there is no input. I'll reverse this order for the horizontal lanes of traffic. Or, if some could show me how to transmit signals wirelessly. As in: I have the proximity sensor near the spot I would like to monitor, then the computer next to the sensor will receive the input, and wirelessly transmit the setBackgroundColor to the actual traffic light. I actually like this way better. All I need to include is the wireless signal, and what the receiving computer should do.. If I only knew how…
I can try to replicate what I did:
m = peripheral.wrap("back")
while true do <—-(to loop)
if rs.getInput("top") then <—–(to grab redstone signal)
m.setBackgroundColor(colors.green)
else
m.clear()
m.setBackgroundColor(colors.red)
m.clear()
end
Edited on 10 May 2017 - 07:08 PM