Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Redstone Signal Emitter Program
- -- Ask for the time interval
- print("Enter the interval in seconds:")
- local input = read()
- local interval = tonumber(input)
- if not interval or interval <= 0 then
- print("Invalid input. Please enter a positive number.")
- return
- end
- -- Ask for the redstone side
- print("Enter the side for redstone signal (e.g., 'top', 'bottom', 'left', 'right', 'front', 'back'):")
- local side = read()
- if not peripheral.isPresent(side) then
- print("Invalid side. Ensure the side is connected and spelled correctly.")
- return
- end
- print("Starting redstone emitter...")
- print("Emitting signal every " .. interval .. " seconds.")
- while true do
- -- Emit the redstone signal
- redstone.setOutput(side, true)
- sleep(1) -- Keep the signal on for 1 second
- redstone.setOutput(side, false)
- -- Wait for the specified interval
- sleep(interval - 1)
- end
Advertisement
Add Comment
Please, Sign In to add comment