fi5hii

Untitled

May 11th, 2024
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. -- Load the required components
  2. local monitor = peripheral.find("monitor", function(name) return name == "monitor_2" end) -- Monitor peripheral named monitor_2
  3.  
  4. -- Function to display line 1 from create_target_1 on monitor_2
  5. function displayLine()
  6. -- Get the line 1 from create_target_1
  7. local line = peripheral.call("create_target_1", "getLine", 1)
  8.  
  9. -- Clear the monitor
  10. monitor.clear()
  11.  
  12. -- Set cursor position at (1,1)
  13. monitor.setCursorPos(1, 1)
  14.  
  15. -- Display the line on monitor
  16. monitor.write(line)
  17. end
  18.  
  19. -- Main function
  20. function main()
  21. while true do
  22. displayLine()
  23. sleep(1) -- Adjust the sleep time as needed
  24. end
  25. end
  26.  
  27. -- Run the main function
  28. main()
  29.  
Advertisement
Add Comment
Please, Sign In to add comment