diff options
| -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 + |
