Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local capacitor = peripheral.wrap("front")
- local maxEnergy = capacitor.getMaxEnergyStored()
- local startLimit = 0.10
- local endLimit = 0.90
- local function power_less(amount)
- local currentEnergy = capacitor.getEnergyStored()
- local percent = currentEnergy / maxEnergy
- print(percent, " < ", amount, " == ", percent < amount)
- return percent < amount
- end
- while true do
- if power_less(startLimit) then
- rs.setOutput("bottom", true)
- print("on")
- while power_less(endLimit) do
- sleep(1)
- end
- rs.setOutput("bottom", false)
- print("off")
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement