Advertisement
Guest User

startup

a guest
Apr 8th, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. local p_min
  2. p_min = 10
  3.  
  4. local p_max
  5. p_max = 90
  6.  
  7. local r
  8.  
  9. r = peripheral.wrap("back")
  10. print(r.getConnected())
  11. max_fuel = 10000000
  12. max = max_fuel/100*p_max
  13. min = max_fuel/100*p_min
  14.  
  15. -- Bucle principal
  16.  
  17. while true do
  18.   state = r.getActive()
  19.   if r.getEnergyStored() >= max and state == true then
  20.     r.setActive(false)
  21.     print("Apagat")
  22.   elseif r.getEnergyStored() <= min and state == false then
  23.     r.setActive(true)
  24.     print("Ences")
  25.   end
  26.   sleep(5)
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement