diff options
| author | rebecca <ubq323@ubq323.website> | 2026-03-01 21:31:48 +0000 |
|---|---|---|
| committer | rebecca <ubq323@ubq323.website> | 2026-03-01 21:31:48 +0000 |
| commit | e6ea2b6c7705167f78ed1b2fc6f4b5dd443abeeb (patch) | |
| tree | 61aef513ccbf9af74ea981a2b30b57f65604f947 | |
| parent | ddaa7c8287175c07e623e4bd7a8e41df29cec05f (diff) | |
radio
| -rw-r--r-- | radio.lua | 16 |
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 + |
