SVty

Rednet Display

May 5th, 2013
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. --Program pro sedmisegmentovy display
  2. --Verze 1.0.1
  3. --Vytvoril SVty
  4. --http://pastebin.com/u/SVty
  5. --http://www.youtube.com/user/SVtyPlay
  6. --***********************
  7. rednet.open("back")
  8. num = { 63, 6, 91, 79, 102, 109, 125, 7, 127, 111, 0 }
  9. while true do
  10. id, y = rednet.receive()
  11. print(y)
  12. y = tonumber(y)
  13. if y > 999 then
  14.   for rep=1,3 do
  15.     rs.setBundledOutput("right",(127-6))
  16.     rs.setBundledOutput("top",(16+64))
  17.     rs.setBundledOutput("left",(16+64))
  18.  
  19.     sleep(1)
  20.  
  21.     rs.setBundledOutput("right",0)
  22.     rs.setBundledOutput("top",0)
  23.     rs.setBundledOutput("left",0)
  24.     sleep(0.5)  
  25.   end
  26. else
  27.   x = y
  28. end
  29.  
  30. a = math.floor(x / 100)
  31. b = math.floor((x - (a * 100)) / 10)
  32. c = math.floor(((x - (a * 100))-(b * 10)))
  33.  
  34.  
  35. if a == 0 then
  36.   a = 10
  37. end
  38.  
  39. if a == 10 and b == 0 then
  40.   b = 10
  41. end
  42.  
  43. print(a)
  44. print(b)
  45. print(c)
  46. rs.setBundledOutput("right",num[a + 1])
  47. rs.setBundledOutput("top",num[b + 1])
  48. rs.setBundledOutput("left",num[c + 1])
  49.  
  50.  
  51. sleep(1)
  52. end
Advertisement
Add Comment
Please, Sign In to add comment