Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function syncImages()
- while true do
- local id, message = rednet.receive()
- if id and message.protocol == "Input" then
- local newImage = io.open("images/" .. message.name, "w")
- newImage.write(newImage, message.data)
- newImage.close(newImage)
- elseif id and message.protocal == "Delete" then
- fs.delete("images/" .. message.name)
- end
- end
- end
- local function main()
- local width, height = term.getSize()
- while true do
- local images = fs.list("/images/")
- for k in pairs(images) do
- term.setBackgroundColor(colors.black)
- term.clear()
- local img = paintutils.loadImage("images/" .. images[k])
- if img then
- paintutils.drawImage(img, 5, 4)
- term.setCursorPos(width / 2 - (string.len(images[k]) / 2), 2)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.write(string.sub(images[k], 1, -5))
- sleep(3)
- end
- end
- end
- end
- --Setting up the terminal and the monitor
- term.clear()
- term.setCursorPos(1, 1)
- term.write("The TV is working")
- local monitor = peripheral.wrap("top")
- monitor.clear()
- term.redirect(monitor)
- monitor.setTextScale(0.5)
- rednet.open("left")
- parallel.waitForAny(syncImages, main)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement