Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --need the 3dprint by NITROGENFINGERS for the turtle http://pastebin.com/tzw1Sw78 user: http://pastebin.com/u/nitrogenfingers
- local monitor_number = "monitor_1"
- local found = fs.exists("monitor.cfg")
- if found == true then
- file = fs.open("monitor.cfg","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- monitor_number = fileData[1]
- end
- local mon = peripheral.wrap(monitor_number)
- os.loadAPI("caAPI")
- mon.setBackgroundColor(8)
- mon.clear()
- mon.setBackgroundColor(8)
- --ini
- local ModemSide = caAPI.detectDivice("modem")
- rednet.open(ModemSide)
- rednet.broadcast("$3Dmon.write ACTIVATE")
- sleep(1)
- --function send
- function send(command)
- local msg = "$PC "..command
- rednet.broadcast(msg)
- end
- --screen
- mon.setTextColor(1)
- mon.setCursorPos(1,1)
- mon.write("Turtle Remote")
- mon.setCursorPos(3,4)
- mon.write("^ *up")
- mon.setCursorPos(1,6)
- mon.write("< >")
- mon.setCursorPos(3,8)
- mon.write("v *down")
- mon.setCursorPos(1,10)
- mon.write("* exit")
- --touchscreen
- input = false
- while input == false do
- event,side,x,y = os.pullEvent()
- if event == "monitor_touch" or event == "mouse_click" then
- if x == 3 and y == 4 then
- send("FW")
- sleep(0.5)
- end
- if x == 1 and y == 6 then
- send("TL")
- sleep(0.5)
- end
- if x == 5 and y == 6 then
- send("TR")
- sleep(0.5)
- end
- if x == 3 and y == 8 then
- send("BK")
- sleep(0.5)
- end
- if x == 9 and y == 4 then
- send("UP")
- sleep(0.5)
- end
- if x == 9 and y == 8 then
- send("DW")
- sleep(0.5)
- end
- if x == 1 and y == 10 then
- input = true
- rednet.close(ModemSide)
- shell.run("clear")
- end
- end
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement