Posted 13 February 2015 - 04:05 PM
Ok I know this will probably be something that most of you can do but I am new to programming and I am still in MS but I have a made a simple program (I mean really simple it's under 100 lines) that uses a 1x1 monitor and has a "Lock" and an "Open" button which activates redstone. Yes it is simple but it is visually appealing I am proud of it because it is my first time using Touch Screens so I thought others might like it too…
How it Works:
Infinite Loop Testing for someone to touch the monitor
Detects if they hit Open or Lock
Toggles Redstone Accordingly
———————————————————————
run "pastebin get XyiqV0Wh startup
with wired modems and Networking Cable Hook up a monitor (1x1)
Be sure to change the monitor name to whatever your using.(This Should be on the first line of code)
then on the left and right side of the computer redstone will turn on when the "open" button is pished so wore the redstone to your door. (This will work with Piston Doors of most kinds)
Hope you like it!
How it Works:
Infinite Loop Testing for someone to touch the monitor
Detects if they hit Open or Lock
Toggles Redstone Accordingly
———————————————————————
mon = peripheral.wrap("monitor_1")
rednet.open("bottom")
while true do
mon.setBackgroundColor(colors.black)
mon.clear()
mon.setTextColor(colors.black)
mon.setTextScale(2)
mon.setBackgroundColor(colors.lime)
mon.setCursorPos(1,2)
mon.write("Open")
mon.setBackgroundColor(colors.red)
mon.setCursorPos(1,1)
mon.write("Lock")
event, monid, x, y = os.pullEvent("monitor_touch")
redstone.setOutput("right", false)
redstone.setOutput("left", false)
print (y)
if event == "monitor_touch" and y == 1 then
redstone.setOutput("right", false)
redstone.setOutput("left", false)
rednet.broadcast("locking")
end
if y == 2 then
redstone.setOutput("right", true)
redstone.setOutput("left", true)
end
end
SetUp:run "pastebin get XyiqV0Wh startup
with wired modems and Networking Cable Hook up a monitor (1x1)
Be sure to change the monitor name to whatever your using.(This Should be on the first line of code)
then on the left and right side of the computer redstone will turn on when the "open" button is pished so wore the redstone to your door. (This will work with Piston Doors of most kinds)
Hope you like it!