donovanwest

power

Jan 18th, 2021 (edited)
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.43 KB | None | 0 0
  1. maxEnergy = peripheral.call("front", "getMaxEnergy")
  2. on = true
  3. while(true) do
  4.     currentEnergy = peripheral.call("front", "getEnergy")
  5.     if(currentEnergy / maxEnergy < 0.1) then
  6.         on = true
  7.     end
  8.     if(currentEnergy / maxEnergy > 0.9) then
  9.         on = false
  10.     end
  11.     if(on) then
  12.         redstone.setAnalogOutput("bottom", 15)
  13.     else
  14.         redstone.setAnalogOutput("bottom", 0)
  15.     end
  16.     os.sleep(5)
  17. end
Add Comment
Please, Sign In to add comment