Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("utils")
- os.loadAPI("buttons")
- local mon = peripheral.wrap("right")
- local compressors = {
- ["Alpha compressor"] = {
- comp = utils.fcmpr(0)
- }
- }
- function drawCompressor(mon, cmp, cmpName)
- local temp = utils.kelvinToCelcius(cmp.getTemperature())
- local pres = cmp.getPressure()
- local tCol = colors.red;
- local pCol = colors.red;
- if temp < -100 then tCol = colors.blue
- elseif temp < -50 then tCol = colors.lime
- elseif temp < 0 then tCol = colors.yellow
- else tCol = colors.red end
- if pres < 30 then pCol = colors.red
- elseif pres < 20 then pCol = colors.lime
- elseif pres < 10 then pCol = colors.yellow
- elseif pres < 5 then pCol = colors.orange end
- utils.printCentLn(mon, "--------" .. cmpName .. "--------")
- utils.monWrt(mon, "Temperature: " .. temp .. " C", tCol)
- utils.monNLCR(mon)
- utils.monWrt(mon, "Pressure: " .. pres .. " bar", pCol)
- utils.monNLCR(mon)
- end
- while true do
- for k, v in pairs(compressors) do
- drawCompressor(mon, v.comp, k)
- end
- sleep(0.25)
- utils.rstMon(mon)
- end
Advertisement
Add Comment
Please, Sign In to add comment