Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Sender Script
- -- Define the side where the monitor is connected
- local monitorSide = "top" -- Change this to match your setup
- -- Check if a monitor is connected
- if not peripheral.isPresent(monitorSide) or peripheral.getType(monitorSide) ~= "monitor" then
- print("No monitor found on specified side.")
- return
- end
- -- Open the modem on the specified side
- local modem = peripheral.wrap("top")
- modem.open(123) -- Use any arbitrary port number you like
- -- Function to capture and send the screen data
- local function sendScreenData()
- while true do
- local monitor = peripheral.wrap(monitorSide) -- Wrap the monitor peripheral
- local width, height = monitor.getSize() -- Get screen size
- local screenData = {} -- Initialize table to store screen data
- -- Capture screen data
- for y = 1, height do
- local line = {}
- for x = 1, width do
- local char, textColor, bgColor = monitor.getPixel(x, y)
- table.insert(line, { char, textColor, bgColor })
- end
- table.insert(screenData, line)
- end
- -- Send screen data
- modem.transmit(123, 123, screenData)
- os.sleep(0.1) -- Adjust this delay as needed
- end
- end
- -- Start sending screen data
- sendScreenData()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement