Advertisement
DOGGYWOOF

Untitled

Dec 31st, 2024
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. -- Doggy OS Turtle Remote Control (Controller Side)
  2.  
  3. -- Configuration
  4. local modemSide = "left" -- Change to the side your modem is on
  5.  
  6. -- Initialize modem
  7. local function initModem()
  8. rednet.open(modemSide) -- Opens the modem for communication
  9. print("Modem initialized. You can now send commands to the turtle.")
  10. end
  11.  
  12. -- Send command to turtle
  13. local function sendCommand(command)
  14. rednet.broadcast(command) -- Send the command to all available turtles
  15. print("Sent command: " .. command)
  16. end
  17.  
  18. -- Display help
  19. local function displayHelp()
  20. print("Commands:")
  21. print("mine - Start mining mode")
  22. print("explore - Start exploration mode")
  23. print("status - Get the turtle's current location and fuel level")
  24. print("stop - Stop the turtle and return to the main menu")
  25. end
  26.  
  27. -- Main program
  28. local function main()
  29. initModem()
  30.  
  31. while true do
  32. displayHelp()
  33. print("Enter command:")
  34. local command = read()
  35.  
  36. if command == "exit" then
  37. print("Exiting remote control.")
  38. break
  39. else
  40. sendCommand(command)
  41. end
  42. end
  43. end
  44.  
  45. main()
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement