Minenat69

Alternator statuses program

Sep 23rd, 2023
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. function sendAlternatorStatus()
  2. local engineStatus1 = redstone.getInput("right")
  3. local engineStatus2 = redstone.getInput("back")
  4. local engineStatus3 = redstone.getInput("left")
  5. local engineStatus4 = redstone.getInput("top")
  6. local engineStatus5 = redstone.getInput("bottom")
  7.  
  8.  
  9. -- sleep(0.2)
  10. modem.transmit(2, 10, {"get_alternator_status_response", engineStatus1, engineStatus2, engineStatus3, engineStatus4, engineStatus5})
  11. end
  12.  
  13.  
  14. function getEvent()
  15. local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  16.  
  17. --print("I just received a message on channel: "..senderChannel)
  18. --print("The message was: "..message)
  19.  
  20. -- Send back message with status of engine
  21. if message == "get_alternator_status_request" then
  22. sendAlternatorStatus()
  23. end
  24.  
  25. getEvent()
  26. end
  27.  
  28. modem = peripheral.wrap("front")
  29. modem.open(10)
  30. getEvent()
Advertisement
Add Comment
Please, Sign In to add comment