Advertisement
lego11

ERGB MONITORAGGIO CORRENTE

Jul 5th, 2020 (edited)
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. shuntA = peripheral.wrap("top")
  2. shuntB = peripheral.wrap("left")
  3. url = "http://rest.rgbcraft.com/corrente/dati.php?nome1="
  4. suffisso = ""
  5. for i=1,9 do
  6. sleep(0.5)
  7. uuid, st, nome, tabella = shuntA.get(i)
  8. h = i+1
  9. nome = string.gsub("%s", "%%20")
  10. suffisso = suffisso..nome.."&potenza"..i.."="..tabella.average.."&nome"..h.."="
  11. print("Shunt A"..i)
  12. end
  13. for i=10,14 do
  14. sleep(0.5)
  15. uuid, st, nome, tabella = shuntB.get(i-9)
  16. h = i+1
  17. suffisso = suffisso..nome.."&potenza"..i.."="..tabella.average.."&nome"..h.."="
  18. print("Shunt B"..i)
  19. end
  20.  
  21. rest = http.get(url..suffisso)
  22. write(rest.readAll())
  23. rest.close()
  24. for j=5,1,-1 do
  25. term.setCursorPos(1, 15)
  26. print("CD: "..j.."   ")
  27. sleep(1)
  28. end
  29. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement