zodiak707

akkustand

Dec 26th, 2025
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. -- Analog-Comparator mit Debug-Ausgabe
  2. -- BACK <= 7  => TOP = 15, sonst TOP = 0
  3.  
  4. local inSide     = "back"
  5. local outSide    = "top"
  6. local threshold  = 7
  7. local tickDelay  = 0.2
  8.  
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. print("=== Redstone Comparator Debug ===")
  12. print("Input : back")
  13. print("Output: top")
  14. print("Threshold <= " .. threshold)
  15. print("--------------------------------")
  16.  
  17. while true do
  18.   local input = redstone.getAnalogInput(inSide) or 0
  19.   local output
  20.  
  21.   if input <= threshold then
  22.     output = 15
  23.     redstone.setAnalogOutput(outSide, output)
  24.   else
  25.     output = 0
  26.     redstone.setAnalogOutput(outSide, output)
  27.   end
  28.  
  29.   -- Debug-Ausgabe aktualisieren
  30.   term.setCursorPos(1,6)
  31.   term.clearLine()
  32.   print("Input  (back):  " .. input)
  33.  
  34.   term.clearLine()
  35.   print("Output (top):   " .. output)
  36.  
  37.   term.clearLine()
  38.   if input <= threshold then
  39.     print("State: ACTIVE (<= threshold)")
  40.   else
  41.     print("State: INACTIVE (> threshold)")
  42.   end
  43.  
  44.   sleep(tickDelay)
  45. end
  46.  
Advertisement
Add Comment
Please, Sign In to add comment