SHOW:
|
|
- or go back to the newest paste.
| 1 | function round(num, idp) | |
| 2 | - | computer = peripheral.wrap('computer_0')
|
| 2 | + | local mult = 10^(idp or 0) |
| 3 | - | monitor = peripheral.wrap('monitor_0')
|
| 3 | + | return math.floor(num * mult + 0.5) / mult |
| 4 | end | |
| 5 | - | if cell.getEnergyStored()/80000000 >= 0,8 then |
| 5 | + | |
| 6 | - | sleep(40) |
| 6 | + | |
| 7 | - | else |
| 7 | + | if round(cell.getEnergyStored()/80000000*100,2) <= 20 then |
| 8 | - | monitor.print('Energy left: '..cell.getEnergyStored()) |
| 8 | + | redstone.setOutput('right',true)
|
| 9 | end | |
| 10 | if round(cell.getEnergyStored()/80000000*100,2) >= 80 then | |
| 11 | redstone.setOutput('right',false)
| |
| 12 | end | |
| 13 | sleep(60) | |
| 14 | end |