Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- arc = peripheral.wrap("back")
- m = peripheral.wrap("right")
- m.setTextColor(colors.green)
- m.setBackgroundColor(colors.red)
- term.clear()
- function updateInfo()
- rod1 = arc.getElectrode(1)
- print(tostring(rod1[1]))
- rod2 = arc.getElectrode(2)
- rod3 = arc.getElectrode(3)
- rodMax = 1000
- end
- function calculate()
- print(tostring(rod1))
- perc1 = (rod1/rodMax)*100
- perc2 = (rod2/rodMax)*100
- perc3 = (rod3/rodMax)*100
- end
- function getMonitor()
- x,y = m.getSize()
- Xvalue = x/100
- end
- function display()
- monperc = perc1*Xvalue
- fillspace = math.ceil(monperc)
- m.setBackgroundColor(colors.red)
- m.clear()
- m.setBackgroundColor(colors.green)
- for i = 1,fillspace do
- for j = 1,y do
- m.setCursorPos(i,j)
- m.write(" ")
- end
- end
- end
- while true do
- updateInfo()
- sleep(0.1)
- calculate()
- sleep(0.1)
- getMonitor()
- sleep(0.1)
- display()
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement