Rename HAM client to HAM client.lua

This commit is contained in:
minecartchris
2025-09-21 19:20:17 -05:00
committed by GitHub
parent 228eeb9034
commit e5e9ed4564

33
HAM client.lua Normal file
View File

@@ -0,0 +1,33 @@
local m = peripheral.find("modem")
--local m = peripheral.wrap(jside)
print("frq 10501-10551")
local frq = tonumber(io.read())
if not (frq >= 10501 and frq <= 10551) then
error("choose a valid frequency!")
end
m.open(frq)
local msgBuffer = {}
parallel.waitForAny(
function()
while true do
print("Type your message:")
local msg = io.read()
m.transmit(frq, frq, {"dlhjs-ChrisHamRadio-dlhjs", msg})
for i, v in pairs(msgBuffer) do
print(v)
end
msgBuffer = {}
end
end,
function()
while true do
local _, _, _, _, msg = os.pullEvent("modem_message")
if type(msg)== "table" then
if msg[1] == "dlhjs-ChrisHamRadio-dlhjs" then
table.insert(msgBuffer, msg[2])
end
end
end
end)