summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrebecca <ubq323@ubq323.website>2026-03-01 21:31:48 +0000
committerrebecca <ubq323@ubq323.website>2026-03-01 21:31:48 +0000
commite6ea2b6c7705167f78ed1b2fc6f4b5dd443abeeb (patch)
tree61aef513ccbf9af74ea981a2b30b57f65604f947
parentddaa7c8287175c07e623e4bd7a8e41df29cec05f (diff)
radio
-rw-r--r--radio.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/radio.lua b/radio.lua
new file mode 100644
index 0000000..10fc431
--- /dev/null
+++ b/radio.lua
@@ -0,0 +1,16 @@
+local channel = 8888
+
+
+local radio = peripheral.find"radio_tower"
+local speaker = peripheral.find"speaker"
+assert(radio and speaker, "aaa")
+
+radio.setFrequency(channel)
+
+local channel_format = string.rep(48000,"b")
+while true do
+ local _,_,data = os.pullEvent"radio_message"
+ assert(#data == 48000,"weird format")
+ speaker.playAudio(string.unpack(channel_format,data))
+end
+