tuekats

inductionFurnace

Jul 6th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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"
  8.  
  9. local chestKey = "0,1,1"
  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. while true do
  20.     local chestState = chestCheck()
  21.  
  22.     print("chest state: " ..chestState)
  23.  
  24.     if chestState < limitLow then
  25.         redstone.setOutput(outputSide,false)
  26.         hystMem = 0
  27.     end
  28.     if (chestState >= limitLow) and (chestState <= limitHigh) then
  29.         if hystMem == 0 then redstone.setOutput(outputSide,false) end
  30.         if hystMem == 1 then redstone.setOutput(outputSide,true) end
  31.  
  32.     end
  33.     if chestState > limitHigh then
  34.         redstone.setOutput(outputSide,true)
  35.         hystMem = 1
  36.     end
  37.     sleep(10)
  38. end
Advertisement
Add Comment
Please, Sign In to add comment