View difference between Paste ID: 5BYmtgcp and bTjeH9cc
SHOW: | | - or go back to the newest paste.
1-
m1 = peripheral.wrap("left")
1+
-- GRAFICO ERGB
2-
m2 = peripheral.wrap("right")
2+
3
mon = peripheral.wrap("back")
4-
function clear()
4+
5
shuntA = peripheral.wrap("top")
6-
term.setCursorPos(1, 1)
6+
shuntB = peripheral.wrap("bottom")
7-
term.setBackgroundColour(colours.black)
7+
url = "http://rest.rgbcraft.com/corrente/dati.php?nome1="
8-
term.setTextColor( colors.white )
8+
suffisso = ""
9
--for i=1,9 do
10-
function link()
10+
for i=1,7 do
11-
term.setTextColour(colours.yellow)
11+
sleep(0.5)
12
uuid, st, nome, tabella = shuntA.get(i)
13-
function fineLink()
13+
h = i+1
14-
term.setTextColour(colours.white)
14+
suffisso = suffisso..nome.."&potenza"..i.."="..tabella.average.."&nome"..h.."="
15
print("Shunt A"..i)
16-
function colore(sfumatura)
16+
17-
term.setTextColour(sfumatura)
17+
--[[
18
--for i=10,14 do
19-
function fineColore()
19+
--sleep(0.5)
20-
term.setTextColour(colours.white)
20+
--uuid, st, nome, tabella = shuntB.get(i-9)
21
--h = i+1
22-
function sfondo(sfumaturaSfondo)
22+
--suffisso = suffisso..nome.."&potenza"..i.."="..tabella.average.."&nome"..h.."="
23-
term.setBackgroundColour(sfumaturaSfondo)
23+
--print("Shunt B"..i)
24
--end
25-
function fineSfondo()
25+
--]]
26-
term.setBackgroundColour(colours.black)
26+
27
rest = http.get(url..suffisso)
28
rest_repl = textutils.unserialize(rest.readAll())
29-
m1.clear()
29+
print(rest.readAll())
30-
term.redirect(m1)
30+
rest.close()
31
 
32-
colore(colours.black)
32+
mon.setTextScale(0.5)
33-
sfondo(colours.yellow)
33+
mon.clear()
34-
print("CryptoXchange | Prezzi                 ")
34+
mon.setCursorPos(1,1)
35-
fineColore()
35+
mon.write("Grafico consumo corrente")
36-
fineSfondo()
36+
37-
h = http.get("http://rest.rgbcraft.com/cryptoxchange/?richiesta=lua_totale")
37+
rest_minmax = http.get("http://rest.rgbcraft.com/corrente/minmax.php")
38-
quotazioni = textutils.unserialize(h.readAll())
38+
39-
h.close()
39+
40-
colore(colors.magenta)
40+
41-
print("\nSimb Nome valuta      Prezzo    Scost.")
41+
for k, v in ipairs(rest_repl) do
42-
fineColore()
42+
43-
ypos = 4
43+
44-
for k,v in pairs(quotazioni) do
44+
45-
	term.setCursorPos(1, ypos)
45+
46-
	term.write(k)
46+
47-
	term.setCursorPos(6, ypos)
47+
48-
	term.write(v["nome"])
48+
49-
	term.setCursorPos(23, ypos)
49+
50-
	term.write(v["prezzo"])
50+
51-
	term.setCursorPos(33, ypos)
51+
52-
	if v["segno"] == "+" then
52+
53-
		colore(colors.lime)
53+
54-
	else
54+
55-
		colore(colors.red)
55+
56-
	end
56+
57-
	term.write(v["scarto"])
57+
58-
	fineColore()
58+
59-
	ypos = ypos + 1
59+
60
for j=5,1,-1 do
61-
colore(colours.yellow)
61+
term.setCursorPos(1, 15)
62-
term.setCursorPos(1, 18)
62+
print("CD: "..j.."   ")
63
sleep(1)
64
end
65-
while true do
65+
os.reboot()