View difference between Paste ID: JMTTcPHj and bgxhJpL1
SHOW: | | - or go back to the newest paste.
1-
local modem = peripheral.wrap("back") -- Wraps the modem on the right side.
1+
2
powerSensor = sensor.wrap("left")
3
4
local hystMem = 0
5
local limitLow = 1
6
local limitHigh = 80
7-
local mfsuKey = "0,0,-1"
7+
local outputSide = "back"
8
9-
function mfsuCheck()
9+
local chestKey = "0,1,1"
10
11-
	sensorReading = powerSensor.getTargetDetails(mfsuKey)  
11+
function chestCheck()
12-
	--print(textutils.serialize(sensorReading))
12+
13
	sensorReading = powerSensor.getTargetDetails(chestKey)  
14-
	level = sensorReading["StoredPercentage"]
14+
15
	level = sensorReading["InventoryPercentFull"]
16
	return level
17
end
18
19-
	print("energy: " ..mfsuCheck())
19+
20-
	modem.transmit(1, 1, mfsuCheck() ) 
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