Quant

R Getter 2C

Jul 3rd, 2015
193
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local symtime=1
  2. local maxreqtime = 5
  3.  
  4.  
  5. local c = require("component")
  6. local s = require("sides")
  7. local r = c.redstone
  8. local l = 0
  9.  
  10. local o = ""
  11. local p = 0
  12. function f()
  13. local u = tonumber(o:reverse())
  14.  for i=1, #o do p=p*2+u%10 u=(u-u%10)/10
  15.   end;
  16. return(p)
  17. end;
  18.  
  19.  
  20.  
  21. while r.getInput(s.left)==0 do  os.sleep(maxreqtime-(os.time()%maxreqtime)+1)
  22. end;
  23. print("Getting")
  24. while r.getInput(s.back)==0 do if r.getInput(s.left)>0 then o=o.."1" else o=o.."0"  end;os.sleep(symtime) end;
  25. print(f())
RAW Paste Data