Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- powerSensor = sensor.wrap("left")
- local hystMem = 0
- local limitLow = 1
- local limitHigh = 80
- local outputSide = "top"
- local chestKey = "0,1,0"
- function chestCheck()
- local sensorReading = {}
- sensorReading = powerSensor.getTargetDetails(chestKey)
- local level = 0
- level = sensorReading["InventoryPercentFull"]
- return level
- end
- redstone.setOutput(outputSide,true)
- while true do
- local chestState = chestCheck()
- print("chest state: " ..chestState)
- if chestState < limitLow then
- redstone.setOutput(outputSide,true)
- hystMem = 0
- end
- if (chestState >= limitLow) and (chestState <= limitHigh) then
- if hystMem == 0 then redstone.setOutput(outputSide,true) end
- if hystMem == 1 then redstone.setOutput(outputSide,false) end
- end
- if chestState > limitHigh then
- redstone.setOutput(outputSide,false)
- hystMem = 1
- end
- sleep(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment