Merge remote-tracking branch 'refs/remotes/origin/main'

This commit is contained in:
Emerson Rosen-Jones 2025-09-13 22:38:17 -04:00
commit eeb2891e9c

23
clock-chime.lua Normal file
View file

@ -0,0 +1,23 @@
-- Program that sends a redstone pulse at noon and midnight
-- the side of the computer to output the pulse
local SIDE = "right"
function pulse ()
rs.setOutput(true, SIDE)
os.sleep(0.05) -- maybe sleep for a tick?
rs.setOutput(false, SIDE)
end
while true do
local timedelta = (os.time("ingame") % 12) * 60 -- all times in seconds
local sleep_amt = ((12 * 60) - timedelta) / 2 -- cut the time in half?
if timedelta < 1 then
pulse()
os.sleep(1) -- don't pulse more than once
elseif sleep_amt > 1 then
os.sleep(sleep_amt)
else
os.sleep(0.2)
end
end