SHOW:
|
|
- or go back to the newest paste.
| 1 | os.loadAPI("ocs/apis/sensor")
| |
| 2 | powerSensor = sensor.wrap("left")
| |
| 3 | ||
| 4 | local hystMem = 0 | |
| 5 | local limitLow = 1 | |
| 6 | local limitHigh = 80 | |
| 7 | - | local outputSide = "back" |
| 7 | + | local outputSide = "top" |
| 8 | ||
| 9 | - | local chestKey = "0,1,1" |
| 9 | + | local chestKey = "0,1,0" |
| 10 | ||
| 11 | function chestCheck() | |
| 12 | local sensorReading = {}
| |
| 13 | sensorReading = powerSensor.getTargetDetails(chestKey) | |
| 14 | local level = 0 | |
| 15 | level = sensorReading["InventoryPercentFull"] | |
| 16 | return level | |
| 17 | end | |
| 18 | ||
| 19 | redstone.setOutput(outputSide,true) | |
| 20 | ||
| 21 | while true do | |
| 22 | local chestState = chestCheck() | |
| 23 | ||
| 24 | print("chest state: " ..chestState)
| |
| 25 | ||
| 26 | if chestState < limitLow then | |
| 27 | redstone.setOutput(outputSide,true) | |
| 28 | hystMem = 0 | |
| 29 | - | if hystMem == 0 then redstone.setOutput(outputSide,false) end |
| 29 | + | |
| 30 | - | if hystMem == 1 then redstone.setOutput(outputSide,true) end |
| 30 | + | |
| 31 | if hystMem == 0 then redstone.setOutput(outputSide,true) end | |
| 32 | if hystMem == 1 then redstone.setOutput(outputSide,false) end | |
| 33 | ||
| 34 | end | |
| 35 | if chestState > limitHigh then | |
| 36 | redstone.setOutput(outputSide,false) | |
| 37 | hystMem = 1 | |
| 38 | end | |
| 39 | sleep(10) | |
| 40 | end |