View difference between Paste ID: bgxhJpL1 and 6QZan5S1
SHOW: | | - or go back to the newest paste.
1
local modem = peripheral.wrap("back") -- Wraps the modem on the right side.
2-
inventorySensor = sensor.wrap("top")
2+
3
4-
fullTabletsKey = "0,-1,-2"
4+
5-
emptyTabletsKey = "0,-1,-4"
5+
powerSensor = sensor.wrap("left")
6
7-
function countContent(inventoryKey)
7+
local mfsuKey = "0,0,-1"
8
9-
	sensorReading = inventorySensor.getTargetDetails(inventoryKey)  
9+
function mfsuCheck()
10
	local sensorReading = {}
11-
	local content = 0
11+
	sensorReading = powerSensor.getTargetDetails(mfsuKey)  
12-
	content = sensorReading["ItemCount"]
12+
13-
	return content
13+
	local level = 0
14
	level = sensorReading["StoredPercentage"]
15
	return level
16
end
17-
	print("full tablets: " ..countContent(fullTabletsKey))
17+
18-
	print("empty tablets: " ..countContent(emptyTabletsKey))
18+
19-
	sleep(30)
19+
	print("energy: " ..mfsuCheck())
20
	modem.transmit(1, 1, mfsuCheck() ) 
21
	sleep(10)
22
end