Advertisement
Hoiafar

BigReactors Turbine RPM Control

Jul 22nd, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. local turbine
  2. local rotorspeed
  3. local maxrotorspeed = 1820
  4. local minrotorspeed = 1780
  5. local turbineactive
  6. local turbinemanip
  7.  
  8. while true do
  9.   turbine= peripheral.wrap("back")
  10.   rotorspeed= turbine.getRotorSpeed()
  11.   write (rotorspeed)
  12.   turbineactive= turbine.getActive()
  13.  
  14.   if rotorspeed > maxrotorspeed then
  15.     write ("Turbine above max speed. Shutting down")
  16.     turbine.setActive(false)
  17.     turbinemanip= true
  18.      
  19.       elseif rotorspeed < minrotorspeed then
  20.         write ("Turbine below max speed. Starting up.")
  21.         turbine.setActive(true)
  22.        
  23.         elseif turbinemanip == true then
  24.             write ("RPM acceptable levels. Turning back on.")
  25.   end
  26.   sleep(5)
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement