This commit is contained in:
2025-06-14 15:22:05 -04:00
parent 5ca8c6d222
commit 495de6bf3e
5 changed files with 45 additions and 48 deletions

View File

@@ -1,23 +1,23 @@
local function getValue(reactor)
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 color(reactor)
local temperature = getValue(reactor)
local function color()
local temperature = getValue()
return colors.black
end
local function watch(reactor, monitor)
print("Temperature: " .. getValue(reactor))
local function watch()
print("Temperature: " .. getValue())
sleep(1)
end
local function report(reactor, monitor)
local value = getValue(reactor)
local color = color(reactor)
local function report()
local value = getValue()
local color = color()
monitor.setBackgroundColor(color)
monitor.clearLine()
monitor.write("Temperature: " .. value .. "F")