Advertisement
Skreple

CC Transmitter

Feb 21st, 2025
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. -- Transmitter Script
  2. -- Define rednet side and redstone input side
  3. local modemSide = "left" -- Change to the side where your modem is
  4. local redstoneInputSide = "right" -- Change to the side where redstone input is detected
  5.  
  6. local receiverID = "UUID" -- Unique string ID for the receiver
  7.  
  8. rednet.open(modemSide)
  9.  
  10. local function updateSignal()
  11.     local signalStrength = redstone.getAnalogInput(redstoneInputSide)
  12.     if signalStrength < 14 then
  13.         rednet.broadcast("deactivate_output", receiverID)
  14.     elseif signalStrength <= 14 then
  15.         rednet.broadcast("activate_output", receiverID)
  16.     end
  17. end
  18.  
  19. -- Initial signal check
  20. updateSignal()
  21.  
  22. while true do
  23.     os.pullEvent("redstone") -- Wait for redstone state change
  24.     updateSignal()
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement