Advertisement
CdoubleOK

Speed control Max

Jun 27th, 2025 (edited)
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | Gaming | 0 0
  1. local modem = peripheral.find("modem")
  2. local monitor = peripheral.wrap("front")
  3.  
  4. monitor.clear()
  5. monitor.setCursorPos(1,1)
  6. term.clear()
  7. term.setCursorPos(1,1)
  8. print("Running...")
  9.  
  10.  
  11. local function shift(side, mode, bgc, tc)
  12.   rs.setOutput(side, true)
  13.   modem.transmit(2,3,mode)
  14.   monitor.setBackgroundColor(bgc)
  15.   monitor.setCursorPos(1,1)
  16.   monitor.clear()
  17.   monitor.setBackgroundColor(bgc)
  18.   monitor.setTextColor(tc)
  19.   monitor.setCursorPos(4, 2)
  20.   monitor.write("Turbine #1")
  21.   monitor.setCursorPos(2, 3)
  22.   monitor.write("-=-=-=-=-=-=-=-")
  23.   monitor.setCursorPos(5, 4)
  24.   monitor.write(mode)
  25.   term.setCursorPos(1,3)
  26.   sleep(1)
  27. end
  28.  
  29. while rs.getInput("front") == false
  30. do
  31.  
  32. if rs.getAnalogInput("top") == 0
  33. then
  34. rs.setOutput("back", false)
  35. shift ("bottom", "Offline", colors.red, colors.white)
  36.  
  37. elseif rs.getAnalogInput("top") >= 1 and rs.getAnalogInput("top") <=8
  38. then
  39. rs.setOutput("back", false)
  40. shift ("bottom", "Low RPM", colors.orange, colors.black)
  41. sleep(10)
  42.  
  43. elseif rs.getAnalogInput("top") >= 9
  44. then
  45. shift ("back", "Engaged", colors.green, colors.white)
  46.  
  47. else
  48. return
  49. end
  50.  
  51. end
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement