49 lines
1.3 KiB
Lua
49 lines
1.3 KiB
Lua
local function run()
|
|
print("Running main loop")
|
|
local tempDriver = require("temperature_monitor")
|
|
while true do
|
|
monitor.clear()
|
|
monitor.setCursorPos(1,1)
|
|
|
|
local data = {
|
|
{ Label = "Temperature", value = tempDriver.report()},
|
|
{ Label = "Pressure", value = "101kPa" },
|
|
{ Label = "Humidity", value = "45%" }
|
|
}
|
|
|
|
for i, item in ipairs(data) do
|
|
monitor.write(item.Label .. ": " .. item.value)
|
|
monitor.setCursorPos(1, i + 1)
|
|
end
|
|
|
|
sleep(1)
|
|
end
|
|
end
|
|
|
|
return { run = run }
|
|
|
|
-- local monitor = peripheral.wrap("top")
|
|
-- local modem = peripheral.wrap("back")
|
|
-- print(monitor)
|
|
-- monitor.clear()
|
|
-- monitor.setTextScale(1)
|
|
-- local maxWidth, maxHeight = monitor.getSize()
|
|
-- local y = 1
|
|
-- monitor.setCursorPos(1, y)
|
|
-- local init = "Initalizing stream...."
|
|
-- monitor.write(init)
|
|
-- print(init)
|
|
-- y = y+1
|
|
-- modem.open(80)
|
|
|
|
-- while true do
|
|
-- local _, _, _, _, message = os.pullEvent("modem_message")
|
|
-- monitor.setCursorPos(1, y)
|
|
-- print(message)
|
|
-- monitor.write(message)
|
|
-- y=y+1
|
|
-- if(y > maxHeight) then
|
|
-- y=maxHeight
|
|
-- monitor.scroll(1)
|
|
-- end
|
|
-- end |