Locus_Solus

Untitled

Jan 26th, 2025
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. -- Redstone Signal Emitter Program
  2.  
  3. -- Ask for the time interval
  4. print("Enter the interval in seconds:")
  5. local input = read()
  6. local interval = tonumber(input)
  7.  
  8. if not interval or interval <= 0 then
  9. print("Invalid input. Please enter a positive number.")
  10. return
  11. end
  12.  
  13. -- Ask for the redstone side
  14. print("Enter the side for redstone signal (e.g., 'top', 'bottom', 'left', 'right', 'front', 'back'):")
  15. local side = read()
  16.  
  17. if not peripheral.isPresent(side) then
  18. print("Invalid side. Ensure the side is connected and spelled correctly.")
  19. return
  20. end
  21.  
  22. print("Starting redstone emitter...")
  23. print("Emitting signal every " .. interval .. " seconds.")
  24.  
  25. while true do
  26. -- Emit the redstone signal
  27. redstone.setOutput(side, true)
  28. sleep(1) -- Keep the signal on for 1 second
  29. redstone.setOutput(side, false)
  30.  
  31. -- Wait for the specified interval
  32. sleep(interval - 1)
  33. end
  34.  
Advertisement
Add Comment
Please, Sign In to add comment