local max = 250 local min = 212 local function getValue() local kelvin = reactor.getTemperature() or 0 local fahrenheit = (kelvin - 273.15) * 9 / 5 + 32 return math.floor(fahrenheit * 10000 + 0.5) / 10000 end local function checkTemperature() local temperature = getValue() local upperThreshold = max - 20 local lowerThreshold = min + 20 if temperature >= upperThreshold then print("Warning: Temperature approaching upper limit! Taking action.") burnRateDriver.stepDown() elseif temperature <= lowerThreshold then print("Warning: Temperature approaching lower limit! Taking action.") burnRateDriver.stepUp() end end local function color() local temperature = getValue() return colors.black end -- local function watch() -- while true do -- print("Temperature: " .. getValue()) -- checkTemperature() -- sleep(0.05) -- Update every tenth second -- end -- end local function watch() checkTemperature() end local function report() local value = getValue() local color = color() monitor.setBackgroundColor(color) monitor.clearLine() monitor.write("Temperature: " .. value .. "F") end return { report = report, watch = watch }