szymski

DFPWM Recorder

Jan 22nd, 2017
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. -- DFPWM Tape recorder by http://szymekk.me
  2.  
  3. local args = { ... }
  4.  
  5. local link = args[1]
  6. local label = args[2]
  7.  
  8. if not args[1] then
  9.     print("Usage: tape-download link [label]")
  10.     return
  11. end
  12.  
  13. print("Downloading the file")
  14. local response = http.get("http://home.szymekk.me/dfpwm/convert.py?link=" .. link)
  15.  
  16. if label then
  17.     tape.setLabel(label)
  18. end
  19.  
  20. tape = peripheral.wrap("left")
  21. print("Recording tape")
  22. data = response.readLine()
  23. while data do
  24.     tape.write(tonumber(data))
  25.     data = response.readLine()
  26. end
  27.  
  28. print("Done! Please rewind the tape.")
Advertisement
Add Comment
Please, Sign In to add comment