Advertisement
Guest User

Untitled

a guest
Sep 10th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.46 KB | None | 0 0
  1. local component = require("component")
  2. local gpu = component.gpu
  3. local state = 0
  4. local colors = require("colors")
  5.  
  6. local minTempDisplay = 200
  7. local maxTempDisplay = 1200
  8. local w,h = gpu.maxResolution()
  9. local margin = 1
  10. local DPP = (maxTempDisplay-minTempDisplay)/(h-margin*2)
  11.  
  12. local CORE  = component.proxy("edc0b78a-94bc-4b92-9fb6-7ba2a6d6fdad")
  13. local CONTROL = component.proxy("587a8d4d-b2a7-4505-9a02-a84268a5d940")
  14.  
  15. local raiseRodTemp = 600
  16. local lowerRodTemp = 700
  17.  
  18.  
  19. gpu.setResolution(w,h)
  20. CONTROL.lowerRods()
  21.  
  22. while true do
  23.   gpu.fill(margin,margin,1,h-margin," ")
  24.   for i=margin,w-2*margin,1 do
  25.     temp = CORE.getTemperature()
  26.     gpu.fill(i+margin,margin,1,h-margin," ")
  27.     gpu.setForeground(colors.grey,true)
  28.     gpu.set(i,h-(lowerRodTemp/DPP+1),"▁")
  29.     gpu.set(i,h-(raiseRodTemp/DPP+1),"▁")
  30.     if temp >= 1000 then gpu.setForeground(colors.red,true) end
  31.     if temp >= 400 and temp < 1000 then gpu.setForeground(colors.green,true) end
  32.     if temp < 400 then gpu.setForeground(colors.blue,true) end
  33.     gpu.set(i,h-(margin+temp/DPP),"█")
  34.     if temp >= lowerRodTemp and state == 1 then
  35.      CONTROL.lowerRods()
  36.      state = 0
  37.      gpu.setForeground(colors.white,true)
  38.      gpu.set(i,h-(margin+temp/DPP),"█")
  39.     end
  40.     if temp <= raiseRodTemp and state == 0 then
  41.      CONTROL.raiseRods()
  42.      state = 11
  43.      gpu.setForeground(colors.white,true)
  44.      gpu.set(i,h-(margin+temp/DPP),"█")
  45.     end
  46.     os.sleep(0.02)
  47.   end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement