Stravides

radios

Mar 10th, 2014
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. --  
  2. --  Stravides Radio Station Program
  3. --  
  4. m = peripheral.wrap("top")
  5. os.unloadAPI("button")
  6. os.loadAPI("button")
  7.  
  8. local currentSide="back"
  9. local currentVolume=1
  10.  
  11. local radio1
  12. local radio2
  13. local radio3
  14. local radio4
  15.  
  16. function quietplease()
  17.    rs.setAnalogOutput("left",0)
  18.    rs.setAnalogOutput("right",0)
  19.    rs.setAnalogOutput("back",0)
  20. --   rs.setAnalogOutput)"front",0)
  21. end
  22.  
  23. function play(side,volume)
  24.    quietplease()
  25.    currentSide=side
  26.    currentVolume=volume
  27.    rs.setAnalogOutput(side,volume)
  28. end
  29.  
  30. function setup()
  31. --   os.pullEvent = os.pullEventRaw  
  32. --   radio1=peripheral.wrap("left")
  33. --   radio2=peripheral.wrap("back")
  34. --   radio3=peripheral.wrap("right")
  35. --   radio4=peripheral.wrap("front")
  36. end
  37.  
  38. button.setMon("top")
  39. button.add("radio1","Trance","flash",2,2,15,5, colors.red,colors.green, function() play("back",currentVolume) end)
  40. button.setState("radio1",false)
  41. button.add("radio2","Slay Radio","flash",2,7,15,12, colors.red,colors.green, function() play("left",currentVolume) end)
  42. button.setState("radio2",false)
  43. button.draw()
  44. while true do
  45. button.check()
  46. end
Advertisement
Add Comment
Please, Sign In to add comment