View difference between Paste ID: JAgfqmq0 and aYGL75PD
SHOW: | | - or go back to the newest paste.
1
os.loadAPI("ocs/apis/sensor")
2-
  prox = sensor.wrap("left")
2+
prox = sensor.wrap("left")
3-
 
3+
rednet.open("back")
4-
  local target = prox.getTargets()
4+
local target = prox.getTargets()
5-
 
5+
local consumati = 0
6
local shunt
7-
    --fetch the detailed information table for the current target.
7+
8
    local details = prox.getTargetDetails(tarName)
9-
    if details["RawName"] == "tile.averagecounter" then
9+
    if details["RawName"] == "tile.blockaveragecounter" then
10-
      for k, v in pairs(details) do
10+
        shunt = tarName;
11-
          print(tostring(k)..": "..tostring(v))
11+
12-
      end
12+
end
13
if shunt == nil then
14-
    sleep(2)
14+
    os.exit()
15-
end
15+
end
16
17
while true do
18
    local details = prox.getTargetDetails(shunt)
19
    consumo = tostring(math.floor((details["EnergyEmitted"]-consumati)/21)).."Kw"
20
    rednet.send(2,consumo)
21
    consumati = details["EnergyEmitted"]
22
    if rs.testBundledInput ("bottom", colors.lime) == true then
23
        rs.setBundledOutput("bottom", colors.black)
24
    else
25
        rs.setBundledOutput("bottom" , 0)
26
    end
27
    sleep(1)
28
end
29