View difference between Paste ID: nHmnmbzs and 6jeJ35P1
SHOW: | | - or go back to the newest paste.
1
modemC = peripheral.wrap('back') --cable
2
modemW = peripheral.wrap('bottom')--wifi
3
chan = 51
4
reponse = nil
5
 
6
rednet.open('bottom')
7
rednet.open('back')
8
modemW.open(5)
9
10
11
EUn1 = 0
12
EUn2 = 0
13
RFn1 = 0
14
RFn2 = 0
15
EU2n1 = 0
16
EU2n2 = 0
17
RF2n1 = 0
18
RF2n2 = 0
19
moni = peripheral.wrap("monitor_2")
20
moni.setBackgroundColor(colors.black)
21
moni.setTextScale(1)
22
mfe = peripheral.wrap("right")
23
mfe2 = peripheral.wrap("ic2:mfsu_0")
24
mfeMax = mfe.getEUCapacity()
25
mfe2Max = mfe2.getEUCapacity()
26
cube2 = peripheral.wrap("left")
27
cube = peripheral.wrap("Advanced Energy Cube_1")
28
cubeMax = cube.getMaxEnergy()
29
cube2Max = cube2.getMaxEnergy()
30
31
32
function quelColor(energy)
33
if energy < 20 then c = colors.red end
34
if energy >20 and energy < 70 then c = colors.yellow end
35
if energy > 70 then c = colors.green  end
36
return(c)
37
end
38
39
function titre (x,y,titre,c)
40
moni.setTextColor(c)
41
moni.setCursorPos(x,y)
42
moni.write (titre)
43
end
44
45
function etat (x,y,n1,n2)
46
e = (n1 - n2)/100
47
e = math.floor (e)/10
48
if e < 0 then c = colors.red
49
else c = colors.green end
50
moni.setTextColor(c)
51
moni.setCursorPos(x,y)
52
moni.write (e)
53
moni.write ('K')
54
end
55
56
function barre (x,y,ener,col)
57
moni.setCursorPos(x,y)
58
I = ener /8
59
for i =1,I do
60
moni.setBackgroundColor(col)
61
moni.write(" ")
62
end
63
moni.setBackgroundColor(colors.black)
64
end
65
66
 
67
while true do
68
EU = math.floor(((mfe.getEUStored() ) / mfeMax ) *1000)/10
69
EU2 = math.floor(((mfe2.getEUStored() ) / mfe2Max ) *1000)/10
70
RF = math.floor((cube.getEnergy() / cubeMax ) *1000)/10
71
RF2 = math.floor((cube2.getEnergy() / cube2Max ) *1000)/10
72
EUn1 = mfe.getEUStored()
73
EU2n1 = mfe2.getEUStored()
74
RFn1 = cube.getEnergy()
75
RF2n1 = cube2.getEnergy()
76
77
moni.clear()
78
79
titre(2,2,"RF Principal",colors.white)
80
81
titre(2,7,"RF Secondaire",colors.white)
82
83-
modemW.transmit(chan,57,cube2Max)
83+
84
85
titre (16,7,"EU Secondaire",colors.white)
86
87
 
88-
modemW.transmit(chan,58,mfeMax)
88+
89
if EU2 < 90 then fan = 1
90
else fan = 0 end
91
modemW.transmit (5,fan,fan)
92
93-
modemW.transmit(chan,59,mfeMax)
93+
94
moni.write("%")
95
barre(16,4,EU,quelColor(EU))
96
etat(19,5,EUn1,EUn2)
97
98
titre(20,8,EU2,quelColor(EU2))
99
moni.write("%")
100
barre(16,9,EU2,quelColor(EU2))
101
etat(19,10,EU2n1,EU2n2)
102
103
104
titre(6,3,RF,quelColor(RF))
105
moni.write("%")
106
barre(2,4,RF,quelColor(RF))
107
etat(5,5,RFn1,RFn2)
108
109
110
titre(6,8,RF2,quelColor(RF2))
111
moni.write("%")
112
barre(2,9,RF2,quelColor(RF2))
113
etat(5,10,RF2n1,RF2n2)
114
115
moni.setBackgroundColor(colors.black)
116
modemW.transmit(chan,56,cubeMax)
117
sleep(1)
118
modemW.transmit(chan,52,RFn1)
119
sleep(1)modemW.transmit(chan,57,cube2Max)
120
sleep(1)
121
modemW.transmit(chan,53,RF2n1)
122
sleep(1)modemW.transmit(chan,58,mfeMax)
123
sleep(1)
124
modemW.transmit(chan,54,EUn1)
125
sleep(1)modemW.transmit(chan,59,mfeMax)
126
sleep(1)
127
modemW.transmit(chan,55,EU2n1)
128
sleep(1)
129
130
EUn2 = EUn1
131
EU2n2 = EU2n1
132
RFn2 = RFn1
133
RF2n2 = RF2n1
134
135
sleep(15)
136
end