Advertisement
willwac

Random Notes

Sep 15th, 2013
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. os.loadAPI("rom/apis/miscperipheralsutil")
  2.  
  3. note, noteSide = miscperipheralsutil.getPeripheral("note")
  4. if note == nil then
  5.   print("No Note peripheral found")
  6.   return
  7. end
  8.  
  9. if note == nil then
  10.   print("No Iron Note Block peripheral found")
  11.   return
  12. end
  13.  
  14. print("Using Iron Note Block peripheral on "..noteSide)
  15. print("Press any key to stop")
  16.  
  17. parallel.waitForAny(
  18.   function()
  19.     while true do
  20.       note.playNote(math.random(0, 4), math.random(0, 24))
  21.       sleep(0.25)
  22.     end
  23.   end,
  24.   function()
  25.     os.pullEvent("char")
  26.   end
  27. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement