Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Connect to the Energizer peripheral
- local energizer = peripheral.wrap("back")
- if not energizer then
- error("Energizer not found on back side!")
- end
- -- Connect to the monitor
- local monitor = peripheral.wrap("top")
- if not monitor then
- error("Monitor not found on top side!")
- end
- -- Store the current terminal device (the Advanced Computer's screen)
- local console = term.current()
- -- Redirect output to the monitor
- term.redirect(monitor)
- monitor.clear()
- monitor.setTextScale(0.5)
- monitor.setCursorPos(1, 1)
- monitor.setTextColor(colors.white)
- monitor.setBackgroundColor(colors.black)
- -- Check and set active state
- monitor.write("Current Active: " .. tostring(energizer.getActive()))
- monitor.setCursorPos(1, 2)
- energizer.setActive(true)
- monitor.write("Set to active!")
- monitor.setCursorPos(1, 3)
- monitor.write("New Active: " .. tostring(energizer.getActive()))
- -- Restore terminal by redirecting back to the console
- term.redirect(console)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement