Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Piano player
- --version 1.0.1
- --Last updated 14 July 2015
- --For use with 'Computercraft nbs player' https://pastebin.com/0UZv2wUt
- -- or '18107's Jukebox' http://pastebin.com/B5dxWyxg
- local modem = peripheral.find("modem")
- local event, temp, data
- local side = true
- modem.open(1) --piano
- --[[
- 1 - piano
- 2 - double bass
- 3 - bass drum
- 4 - snare drum
- 5 - click
- ]]--
- while true do
- event, temp, temp, temp, data = os.pullEventRaw()
- if event == "terminate" then
- modem.closeAll()
- return
- end --if terminate
- if event == "modem_message" then
- if side then
- side = false
- rs.setBundledOutput("front", bit.band(data, 4095))
- rs.setBundledOutput("left", 0)
- rs.setBundledOutput("back", bit.blogic_rshift(data, 12))
- rs.setBundledOutput("right", 0)
- else
- side = true
- rs.setBundledOutput("left", bit.band(data, 4095))
- rs.setBundledOutput("front", 0)
- rs.setBundledOutput("right", bit.blogic_rshift(data, 12))
- rs.setBundledOutput("back", 0)
- end --if side
- end --if modem_message
- end --while all
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement