Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local side_capacitor = 'left'
- local conduit = 'top'
- local cell = peripheral.wrap(side_capacitor)
- -- print(cell.listMethods())
- local min = 95
- local max = 99
- local max_store = cell.getMaxEnergyStored()
- rs.setOutput(conduit, false)
- local working = true
- print 'ON'
- while true do
- local store = cell.getEnergyStored()
- local perc = store/max_store * 100
- print(perc)
- if working then
- if perc >= max then
- rs.setOutput(conduit, true)
- working = false
- print 'off'
- else
- rs.setOutput(conduit, false)
- end
- else
- if perc <= min then
- rs.setOutput(conduit, false)
- working = true
- print 'on'
- else
- rs.setOutput(conduit, true)
- end
- end
- os.sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement