tommy2805

test sse

Oct 4th, 2023 (edited)
1,194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("ocs/apis/sensor")
  2. prox = sensor.wrap("left")
  3. rednet.open("back")
  4. local target = prox.getTargets()
  5. local consumati = 0
  6. local shunt
  7. for tarName, _ in pairs(target) do
  8.     local details = prox.getTargetDetails(tarName)
  9.     if details["RawName"] == "tile.blockaveragecounter" then
  10.         shunt = tarName;
  11.     end
  12. end
  13. if shunt == nil then
  14.     os.exit()
  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.  
Advertisement
Add Comment
Please, Sign In to add comment