updated
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
local function report()
|
||||
local reactor = peripheral.find("fissionReactorLogicAdapter")
|
||||
local function report(reactor)
|
||||
if reactor then
|
||||
return reactor.getTemperature()
|
||||
return reactor.getCoolantFilledPercentage()
|
||||
else
|
||||
return "No reactor found"
|
||||
end
|
||||
end
|
||||
|
||||
return { report = report }
|
||||
local function watch(reactor, monitor)
|
||||
while true do
|
||||
print("Coolant: " .. report(reactor))
|
||||
sleep(1)
|
||||
end
|
||||
end
|
||||
|
||||
return { report = report, watch = watch }
|
||||
6
main.lua
6
main.lua
@@ -1,15 +1,19 @@
|
||||
local function run()
|
||||
local kernel = require("kernel")
|
||||
local tempDriver = kernel.addDriver("temperature_driver")
|
||||
local coolantDriver = kernel.addDriver("coolant_driver")
|
||||
local reactor = peripheral.find("fissionReactorLogicAdapter")
|
||||
local monitor = peripheral.find("monitor")
|
||||
while true do
|
||||
monitor.clear()
|
||||
monitor.setCursorPos(1,1)
|
||||
|
||||
tempDriver.watch(reactor, monitor)
|
||||
coolantDriver.watch(reactor, monitor)
|
||||
|
||||
local data = {
|
||||
{ Label = "Temperature", value = tempDriver.report(reactor)},
|
||||
{ Label = "Pressure", value = "101kPa" },
|
||||
{ Label = "Coolant", value = coolantDriver.report(reactor) },
|
||||
{ Label = "Humidity", value = "45%" }
|
||||
}
|
||||
|
||||
|
||||
@@ -6,4 +6,11 @@ local function report(reactor)
|
||||
end
|
||||
end
|
||||
|
||||
return { report = report }
|
||||
local function watch(reactor, monitor)
|
||||
while true do
|
||||
print("Temperature: " .. report(reactor))
|
||||
sleep(1)
|
||||
end
|
||||
end
|
||||
|
||||
return { report = report, watch = watch }
|
||||
Reference in New Issue
Block a user