SHOW:
|
|
- or go back to the newest paste.
| 1 | local capacitor = peripheral.wrap("front")
| |
| 2 | local maxEnergy = capacitor.getMaxEnergyStored() | |
| 3 | local startLimit = 0.10 | |
| 4 | local endLimit = 0.90 | |
| 5 | ||
| 6 | local function power_less(amount) | |
| 7 | local currentEnergy = capacitor.getEnergyStored() | |
| 8 | local percent = currentEnergy / maxEnergy | |
| 9 | ||
| 10 | - | --print(percent, " < ", amount, " == ", percent < amount) |
| 10 | + | print(percent, " < ", amount, " == ", percent < amount) |
| 11 | ||
| 12 | return percent < amount | |
| 13 | end | |
| 14 | ||
| 15 | while true do | |
| 16 | if power_less(startLimit) then | |
| 17 | rs.setOutput("bottom", true)
| |
| 18 | - | --print("on")
|
| 18 | + | print("on")
|
| 19 | ||
| 20 | while power_less(endLimit) do | |
| 21 | sleep(1) | |
| 22 | end | |
| 23 | ||
| 24 | rs.setOutput("bottom", false)
| |
| 25 | - | --print("off")
|
| 25 | + | print("off")
|
| 26 | end | |
| 27 | ||
| 28 | sleep(1) | |
| 29 | end |