Advertisement
Guest User

afich7segmen10-2

a guest
Jul 27th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. local idChannel = 126
  2. local numdigit = 0
  3. local correspondance = {}
  4. correspondance[0] = { 0,0,0,0,0,0,0 }
  5. correspondance[1] = { 0,0,0,0,0,0,0 }
  6. correspondance[2] = { 0,0,0,0,0,0,0 }
  7. correspondance[3] = { 0,0,0,0,0,0,0 }
  8. correspondance[4] = { 0,0,0,0,0,0,0 }
  9. correspondance[5] = { 0,0,0,0,0,0,0 }
  10. correspondance[6] = { 0,0,0,0,0,0,0 }
  11. correspondance[7] = { 0,0,0,0,0,0,0 }
  12. correspondance[8] = { 0,0,0,0,0,0,0 }
  13. correspondance[9] = { 0,0,0,0,0,0,0 }
  14. correspondance[10] = { 1,1,1,0,1,1,1 }
  15. correspondance[11] = { 0,0,1,0,0,1,0 }
  16. correspondance[12] = { 1,1,0,1,0,1,1 }
  17. correspondance[13] = { 1,0,1,1,0,1,1 }
  18. correspondance[14] = { 0,0,1,1,1,1,0 }
  19. correspondance[15] = { 1,0,1,1,1,0,1 }
  20. correspondance[16] = { 1,1,1,1,1,0,1 }
  21. correspondance[17] = { 0,0,1,0,0,1,1 }
  22. correspondance[18] = { 1,1,1,1,1,1,1 }
  23. correspondance[19] = { 1,0,1,1,1,1,1 }
  24. correspondance[20] = { 1,1,0,1,0,1,1 }
  25.  
  26.  
  27. if fs.exists("digit.ini") then
  28. h = fs.open("digit.ini", "r")
  29. numdigit = h.readAll()
  30. h.close()
  31. else
  32. h = fs.open("digit.ini", "w")
  33. print("1er demarrage, indiquer num digit :")
  34. numdigit = read()
  35. h.write(numdigit)
  36. h.close()
  37. end
  38.  
  39. modem = peripheral.wrap("bottom")
  40.  
  41. while true do
  42. modem.open(idChannel)
  43. event, modemSide, senderChannel, replyChannel, text, senderDistance = os.pullEvent("modem_message")
  44.  
  45. if correspondance[text][tonumber(numdigit)] == 1 then
  46. redstone.setOutput("back", true)
  47. else
  48. redstone.setOutput("back", false)
  49. end
  50.  
  51. modem.close(idChannel)
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement