Last active
June 2, 2025 20:42
-
-
Save qazer2687/3f0d33abfefaee440113ad5542e73f5e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Made by @qazer2687 on GitHub. | |
| -- Function to get and print redstone strength | |
| function printRedstoneStrength() | |
| -- Wrap the monitor peripheral | |
| local monitor = peripheral.wrap("bottom") -- Replace "monitor_0" with the actual peripheral name | |
| -- Verify the monitor is properly wrapped | |
| if not monitor then | |
| error("Monitor not found or not connected") | |
| end | |
| -- Set the text scale | |
| monitor.setTextScale(5) -- Adjust text scale as needed | |
| -- Loop to continuously check redstone strength | |
| while true do | |
| -- Get the redstone strength from the back (adjust as needed) | |
| local strength = redstone.getAnalogInput("back") | |
| -- Clear the screen | |
| monitor.clear() | |
| -- Calculate center position | |
| local w, h = monitor.getSize() | |
| local centerX = math.floor(w / 2) | |
| local centerY = math.floor(h / 2) | |
| -- Set cursor to the center and print the redstone strength | |
| monitor.setCursorPos(centerX - 1, centerY) | |
| monitor.write(tostring(strength)) | |
| -- Wait for a short period before checking again | |
| os.sleep(1) | |
| end | |
| end | |
| -- Run the function | |
| printRedstoneStrength() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment