bughert

storage controller

Nov 23rd, 2024 (edited)
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.92 KB | None | 0 0
  1. m = peripheral.wrap("right")
  2. redf = peripheral.wrap("redstoneIntegrator_27")
  3. redb = peripheral.wrap("redstoneIntegrator_28")
  4. redconst = peripheral.wrap("redstoneIntegrator_29")
  5. m.clear()
  6. m.setTextScale(1)
  7. os.loadAPI("button")
  8. button.clearTable()
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. local a = 0
  12. local b = 0
  13. local fin = 0
  14.  
  15. function fillTable()
  16.     button.setTable("get container",getcontainer,2,49,2,6)
  17.     button.setTable("move container",movecontainer,2,49,8,12)
  18.     button.setTable("send container",sendcontainer,2,49,14,18)
  19.     button.screen()
  20. end
  21.  
  22. function getClick()
  23.     event,side,x,y = os.pullEvent("monitor_touch")
  24.     button.checkxy(x,y)
  25. end
  26.  
  27. function getcontainer()
  28.     button.flash("get container")
  29.     fin = 0
  30.     a = 0
  31.     b = 0
  32.         m.clear()
  33.         button.clearTable()
  34.    
  35.  
  36.         function fillTable()
  37.             button.setTable("1",one,2,4,2,4)
  38.             button.setTable("2",two,6,8,2,4)
  39.             button.setTable("3",three,10,12,2,4)
  40.             button.setTable("4",four,14,16,2,4)
  41.             button.setTable("5",five,18,20,2,4)
  42.             button.setTable("6",six,2,4,6,8)
  43.             button.setTable("7",seven,6,8,6,8)
  44.             button.setTable("8",eight,10,12,6,8)
  45.             button.setTable("9",nine,14,16,6,8)
  46.             button.setTable("10",ten,18,21,6,8)
  47.             button.setTable("11",eleven,2,5,10,12)
  48.             button.setTable("12",twelve,7,10,10,12)
  49.             button.setTable("13",thirteen,12,15,10,12)
  50.             button.setTable("14",fourteen,17,20,10,12)
  51.             button.setTable("15",fifteen,22,25,10,12)
  52.             button.setTable("confirm",confirm,39,49,16,18)
  53.             button.screen()
  54.         end
  55.  
  56.         function getClick()
  57.             event,side,x,y = os.pullEvent("monitor_touch")
  58.             button.checkxy(x,y)
  59.         end
  60.  
  61.         function one()
  62.             button.flash("1")
  63.             if a == 0 then
  64.                 a = 1
  65.             else
  66.                 b = 1
  67.             end
  68.         end
  69.  
  70.         function two()
  71.             button.flash("2")
  72.             if a == 0 then
  73.                 a = 2
  74.             else
  75.                 b = 2
  76.             end
  77.         end
  78.  
  79.         function three()
  80.             button.flash("3")
  81.             if a == 0 then
  82.                 a = 3
  83.             else
  84.                 b = 3
  85.             end
  86.         end
  87.  
  88.         function four()
  89.             button.flash("4")
  90.             if a == 0 then
  91.                 a = 4
  92.             else
  93.                 b = 4
  94.             end
  95.         end
  96.  
  97.         function five()
  98.             button.flash("5")
  99.             if a == 0 then
  100.                 a = 5
  101.             else
  102.                 b = 5
  103.             end
  104.         end
  105.  
  106.         function six()
  107.             button.flash("6")
  108.             if a == 0 then
  109.                 a = 6
  110.             else
  111.                 b = 6
  112.             end
  113.         end
  114.  
  115.         function seven()
  116.             button.flash("7")
  117.             if a == 0 then
  118.                 a = 7
  119.             else
  120.                 b = 7
  121.             end
  122.         end
  123.  
  124.         function eight()
  125.             button.flash("8")
  126.             if a == 0 then
  127.                 a = 8
  128.             else
  129.                 b = 8
  130.             end
  131.         end
  132.  
  133.         function nine()
  134.             button.flash("9")
  135.             if a == 0 then
  136.                 a = 9
  137.             else
  138.                 b = 9
  139.             end
  140.         end
  141.  
  142.         function ten()
  143.             button.flash("10")
  144.             if a == 0 then
  145.                 a = 10
  146.             else
  147.                 b = 10
  148.             end
  149.         end
  150.  
  151.         function eleven()
  152.             button.flash("11")
  153.             if a == 0 then
  154.                 a = 11
  155.             else
  156.                 b = 11
  157.             end
  158.         end
  159.  
  160.         function twelve()
  161.             button.flash("12")
  162.             if a == 0 then
  163.                 a = 12
  164.             else
  165.                 b = 12
  166.             end
  167.         end
  168.  
  169.         function thirteen()
  170.             button.flash("13")
  171.             if a == 0 then
  172.                 a = 13
  173.             else
  174.                 b = 13
  175.             end
  176.         end
  177.  
  178.         function fourteen()
  179.             button.flash("14")
  180.             if a == 0 then
  181.                 a = 14
  182.             else
  183.                 b = 14
  184.             end
  185.         end
  186.  
  187.         function fifteen()
  188.             button.flash("15")
  189.             if a == 0 then
  190.                 a = 15
  191.             else
  192.                 b = 15
  193.             end
  194.         end
  195.  
  196.         function confirm()
  197.             button.flash("confirm")
  198.             fin = 1
  199.         end
  200.         fillTable()
  201.         button.heading("enter coordinates of container to be moved:")
  202.     while fin == 0 do
  203.         getClick()
  204.         m.setCursorPos(2,14)
  205.         m.write("koordynaty - x: ",a," y: ",b)
  206.     end
  207.     redf.setOutput("north",true) --do zrobienia - sygnal blokujacy os y
  208.     sleep(0,5)
  209.     redf.setAnalogOutput("east",a)
  210.     sleep(0,5)
  211.     redf.setAnalogOutput("east",0)
  212.     sleep(5) -- przesuwa sie na osi x
  213.     redf.setOutput("north",false) --odblokowuje os y
  214.  
  215.     sleep(0,5)
  216.     redf.setAnalogOutput("east",b)
  217.     sleep(0,5)
  218.     redf.setAnalogOutput("east",0)
  219.     sleep(3) -- przesuwa sie na osi y
  220.    
  221.     redf.setOutput("north",true) --blokuje os y
  222.     redf.setOutput("down",true) --blokuje os x
  223.     redconst.setOutput("down",true) --wlancza obroty suwnic
  224.     sleep(0,5)
  225.     redf.setOutput("up",true) --emiter sygnalu aktywuje lepki tlok
  226.     sleep(0,5)
  227.     redf.setOutput("up",false)
  228.     sleep(2.5)
  229.     redconst.setOutput("down",false)
  230.     redf.setOutput("north",false) --odblokowuje wszystkie osie oraz wylancza obroty walu
  231.     redf.setOutput("down",false)
  232.  
  233.     sleep(0,5)
  234.     redf.setOutput("north",true) --blokuje os y
  235.     redb.setAnalogOutput("east",a)
  236.     sleep(0,5)
  237.     redb.setAnalogOutput("east",0)
  238.     sleep(5)
  239.     redf.setOutput("north",false) --oblokowyje os y
  240.  
  241.     sleep(0,5)
  242.     redf.setAnalogOutput("east",8 - b)
  243.     sleep(0,5)                          --przesuwa sie na osi y
  244.     redf.setAnalogOutput("east",0)
  245.     sleep(3)
  246.  
  247.     redf.setOutput("north",true) --blokuje os y
  248.     redf.setOutput("down",true) --blokuje os x
  249.     redconst.setOutput("down",true) --wlancza obroty suwnic
  250.     sleep(0,5)
  251.     redf.setOutput("south",true) --emiter sygnalu aktywuje pchajacy tlok
  252.     sleep(0,5)
  253.     redf.setOutput("south",false)
  254.     sleep(2.5)
  255.     redconst.setOutput("down",false)
  256.     redf.setOutput("north",false) --odblokowuje wszystkie osie oraz wylancza obroty walu
  257.     redf.setOutput("down",false)
  258.  
  259.     --powrot do poz. pocz.
  260.     sleep(0,5)
  261.     redb.setAnalogOutput("east",8)
  262.     sleep(0,5)
  263.     redb.setAnalogOutput("east",0)
  264. end
  265.  
  266. function movecontainer()
  267.     button.flash("move container")
  268.     fin = 0
  269.     a = 0
  270.     b = 0
  271.         m.clear()
  272.         button.clearTable()
  273.    
  274.  
  275.         function fillTable()
  276.             button.setTable("1",one,2,4,2,4)
  277.             button.setTable("2",two,6,8,2,4)
  278.             button.setTable("3",three,10,12,2,4)
  279.             button.setTable("4",four,14,16,2,4)
  280.             button.setTable("5",five,18,20,2,4)
  281.             button.setTable("6",six,2,4,6,8)
  282.             button.setTable("7",seven,6,8,6,8)
  283.             button.setTable("8",eight,10,12,6,8)
  284.             button.setTable("9",nine,14,16,6,8)
  285.             button.setTable("10",ten,18,21,6,8)
  286.             button.setTable("11",eleven,2,5,10,12)
  287.             button.setTable("12",twelve,7,10,10,12)
  288.             button.setTable("13",thirteen,12,15,10,12)
  289.             button.setTable("14",fourteen,17,20,10,12)
  290.             button.setTable("15",fifteen,22,25,10,12)
  291.             button.setTable("confirm",confirm,39,49,16,18)
  292.             button.screen()
  293.         end
  294.  
  295.         function getClick()
  296.             event,side,x,y = os.pullEvent("monitor_touch")
  297.             button.checkxy(x,y)
  298.         end
  299.  
  300.         function one()
  301.             button.flash("1")
  302.             if a == 0 then
  303.                 a = 1
  304.             else
  305.                 b = 1
  306.             end
  307.         end
  308.  
  309.         function two()
  310.             button.flash("2")
  311.             if a == 0 then
  312.                 a = 2
  313.             else
  314.                 b = 2
  315.             end
  316.         end
  317.  
  318.         function three()
  319.             button.flash("3")
  320.             if a == 0 then
  321.                 a = 3
  322.             else
  323.                 b = 3
  324.             end
  325.         end
  326.  
  327.         function four()
  328.             button.flash("4")
  329.             if a == 0 then
  330.                 a = 4
  331.             else
  332.                 b = 4
  333.             end
  334.         end
  335.  
  336.         function five()
  337.             button.flash("5")
  338.             if a == 0 then
  339.                 a = 5
  340.             else
  341.                 b = 5
  342.             end
  343.         end
  344.  
  345.         function six()
  346.             button.flash("6")
  347.             if a == 0 then
  348.                 a = 6
  349.             else
  350.                 b = 6
  351.             end
  352.         end
  353.  
  354.         function seven()
  355.             button.flash("7")
  356.             if a == 0 then
  357.                 a = 7
  358.             else
  359.                 b = 7
  360.             end
  361.         end
  362.  
  363.         function eight()
  364.             button.flash("8")
  365.             if a == 0 then
  366.                 a = 8
  367.             else
  368.                 b = 8
  369.             end
  370.         end
  371.  
  372.         function nine()
  373.             button.flash("9")
  374.             if a == 0 then
  375.                 a = 9
  376.             else
  377.                 b = 9
  378.             end
  379.         end
  380.  
  381.         function ten()
  382.             button.flash("10")
  383.             if a == 0 then
  384.                 a = 10
  385.             else
  386.                 b = 10
  387.             end
  388.         end
  389.  
  390.         function eleven()
  391.             button.flash("11")
  392.             if a == 0 then
  393.                 a = 11
  394.             else
  395.                 b = 11
  396.             end
  397.         end
  398.  
  399.         function twelve()
  400.             button.flash("12")
  401.             if a == 0 then
  402.                 a = 12
  403.             else
  404.                 b = 12
  405.             end
  406.         end
  407.  
  408.         function thirteen()
  409.             button.flash("13")
  410.             if a == 0 then
  411.                 a = 13
  412.             else
  413.                 b = 13
  414.             end
  415.         end
  416.  
  417.         function fourteen()
  418.             button.flash("14")
  419.             if a == 0 then
  420.                 a = 14
  421.             else
  422.                 b = 14
  423.             end
  424.         end
  425.  
  426.         function fifteen()
  427.             button.flash("15")
  428.             if a == 0 then
  429.                 a = 15
  430.             else
  431.                 b = 15
  432.             end
  433.         end
  434.  
  435.         function confirm()
  436.             button.flash("confirm")
  437.             fin = 1
  438.         end
  439.         fillTable()
  440.         button.heading("enter coordinates of container to be moved: ")
  441.     while fin == 0 do
  442.         getClick()
  443.         local starta = a
  444.         local startb = b
  445.         m.setCursorPos(2,14)
  446.         m.write("koordynaty poczatkowe - x: ",a," y: ",b)
  447.     end
  448.  
  449.     fin = 0
  450.     a = 0
  451.     b = 0
  452.         m.clear()
  453.         button.clearTable()
  454.    
  455.  
  456.         function fillTable()
  457.             button.setTable("1",one,2,4,2,4)
  458.             button.setTable("2",two,6,8,2,4)
  459.             button.setTable("3",three,10,12,2,4)
  460.             button.setTable("4",four,14,16,2,4)
  461.             button.setTable("5",five,18,20,2,4)
  462.             button.setTable("6",six,2,4,6,8)
  463.             button.setTable("7",seven,6,8,6,8)
  464.             button.setTable("8",eight,10,12,6,8)
  465.             button.setTable("9",nine,14,16,6,8)
  466.             button.setTable("10",ten,18,21,6,8)
  467.             button.setTable("11",eleven,2,5,10,12)
  468.             button.setTable("12",twelve,7,10,10,12)
  469.             button.setTable("13",thirteen,12,15,10,12)
  470.             button.setTable("14",fourteen,17,20,10,12)
  471.             button.setTable("15",fifteen,22,25,10,12)
  472.             button.setTable("confirm",confirm,39,49,16,18)
  473.             button.screen()
  474.         end
  475.  
  476.         function getClick()
  477.             event,side,x,y = os.pullEvent("monitor_touch")
  478.             button.checkxy(x,y)
  479.         end
  480.  
  481.         function one()
  482.             button.flash("1")
  483.             if a == 0 then
  484.                 a = 1
  485.             else
  486.                 b = 1
  487.             end
  488.         end
  489.  
  490.         function two()
  491.             button.flash("2")
  492.             if a == 0 then
  493.                 a = 2
  494.             else
  495.                 b = 2
  496.             end
  497.         end
  498.  
  499.         function three()
  500.             button.flash("3")
  501.             if a == 0 then
  502.                 a = 3
  503.             else
  504.                 b = 3
  505.             end
  506.         end
  507.  
  508.         function four()
  509.             button.flash("4")
  510.             if a == 0 then
  511.                 a = 4
  512.             else
  513.                 b = 4
  514.             end
  515.         end
  516.  
  517.         function five()
  518.             button.flash("5")
  519.             if a == 0 then
  520.                 a = 5
  521.             else
  522.                 b = 5
  523.             end
  524.         end
  525.  
  526.         function six()
  527.             button.flash("6")
  528.             if a == 0 then
  529.                 a = 6
  530.             else
  531.                 b = 6
  532.             end
  533.         end
  534.  
  535.         function seven()
  536.             button.flash("7")
  537.             if a == 0 then
  538.                 a = 7
  539.             else
  540.                 b = 7
  541.             end
  542.         end
  543.  
  544.         function eight()
  545.             button.flash("8")
  546.             if a == 0 then
  547.                 a = 8
  548.             else
  549.                 b = 8
  550.             end
  551.         end
  552.  
  553.         function nine()
  554.             button.flash("9")
  555.             if a == 0 then
  556.                 a = 9
  557.             else
  558.                 b = 9
  559.             end
  560.         end
  561.  
  562.         function ten()
  563.             button.flash("10")
  564.             if a == 0 then
  565.                 a = 10
  566.             else
  567.                 b = 10
  568.             end
  569.         end
  570.  
  571.         function eleven()
  572.             button.flash("11")
  573.             if a == 0 then
  574.                 a = 11
  575.             else
  576.                 b = 11
  577.             end
  578.         end
  579.  
  580.         function twelve()
  581.             button.flash("12")
  582.             if a == 0 then
  583.                 a = 12
  584.             else
  585.                 b = 12
  586.             end
  587.         end
  588.  
  589.         function thirteen()
  590.             button.flash("13")
  591.             if a == 0 then
  592.                 a = 13
  593.             else
  594.                 b = 13
  595.             end
  596.         end
  597.  
  598.         function fourteen()
  599.             button.flash("14")
  600.             if a == 0 then
  601.                 a = 14
  602.             else
  603.                 b = 14
  604.             end
  605.         end
  606.  
  607.         function fifteen()
  608.             button.flash("15")
  609.             if a == 0 then
  610.                 a = 15
  611.             else
  612.                 b = 15
  613.             end
  614.         end
  615.  
  616.         function confirm()
  617.             button.flash("confirm")
  618.             fin = 1
  619.         end
  620.         fillTable()
  621.         button.heading("enter coordinates, where container will be moved: ")
  622.     while fin == 0 do
  623.         m.setCursorPos(2,14)
  624.         m.write("koordynaty pocz. - x: ",starta," y: ",startb)
  625.         m.setCursorPos(2,16)
  626.         m.write("koordynaty docelowe - x: ",a," y: ",b)
  627.     end
  628.     redf.setOutput("north",true) --blokada osi y
  629.     redf.setAnalogOutput("east",starta)
  630.     sleep(0,5)
  631.     redf.setAnalogOutput("east",0)
  632.     sleep(5)
  633.     redf.setOutput("north",false) --odlokowuje os y
  634.  
  635.     sleep(0,5)
  636.     redf.setAnalogOutput("east",startb)
  637.     sleep(0,5)
  638.     redf.setAnalogOutput("east",0)
  639.     sleep(3)
  640.  
  641.     redf.setOutput("north",true) --blokuje os y
  642.     redf.setOutput("down",true) --blokuje os x
  643.     redconst.setOutput("down",true) --wlancza obroty suwnic
  644.     sleep(0,5)
  645.     redf.setOutput("up",true) --emiter sygnalu aktywuje ciagnacy tlok
  646.     sleep(0,5)
  647.     redf.setOutput("up",false)
  648.     sleep(2.5)
  649.     redconst.setOutput("down",false)
  650.     redf.setOutput("north",false) --odblokowuje wszystkie osie oraz wylancza obroty walu
  651.     redf.setOutput("down",false)
  652.  
  653.     redf.setOutput("north",true) --blokada osi y
  654.     redb.setAnalogOutput("east",starta)
  655.     sleep(0,5)
  656.     redb.setAnalogOutput("east",0)
  657.     sleep(5)
  658.     redf.setOutput("north",false) --odlokowuje os y
  659.  
  660.     sleep(0,5)
  661.     redb.setAnalogOutput("east",startb)
  662.     sleep(0,5)                              --powrot do poz. 0 0
  663.     redb.setAnalogOutput("east",0)
  664.     sleep(3)
  665.  
  666.     redf.setOutput("north",true) --blokada osi y
  667.     redf.setAnalogOutput("east",a)
  668.     sleep(0,5)
  669.     redf.setAnalogOutput("east",0)
  670.     sleep(5)
  671.     redf.setOutput("north",false) --odlokowuje os y
  672.  
  673.     sleep(0,5)
  674.     redf.setAnalogOutput("east",b)
  675.     sleep(0,5)
  676.     redf.setAnalogOutput("east",0)
  677.     sleep(3)
  678.  
  679.     redf.setOutput("north",true) --blokuje os y
  680.     redf.setOutput("down",true) --blokuje os x
  681.     redconst.setOutput("down",true) --wlancza obroty suwnic
  682.     sleep(0,5)
  683.     redf.setOutput("south",true) --emiter sygnalu aktywuje pchajacy tlok
  684.     sleep(0,5)
  685.     redf.setOutput("south",false)
  686.     sleep(2.5)
  687.     redconst.setOutput("down",false)
  688.     redf.setOutput("north",false) --odblokowuje wszystkie osie oraz wylancza obroty walu
  689.     redf.setOutput("down",false)
  690.  
  691.     sleep(0,5)
  692.     redf.setOutput("north",true) --blokada osi y
  693.     redb.setAnalogOutput("east",a)
  694.     sleep(0,5)
  695.     redb.setAnalogOutput("east",0)
  696.     sleep(5)
  697.     redf.setOutput("north",false)
  698.  
  699.     sleep(0,5)
  700.     redb.setAnalogOutput("east",b)
  701.     sleep(0,5)                          --powrot do poz. 0 0
  702.     redb.setAnalogOutput("east",0)
  703.     sleep(3)
  704. end
  705.  
  706. function sendcontainer()
  707.     button.flash("send container")
  708.     fin = 0
  709.     a = 0
  710.     b = 0
  711.         m.clear()
  712.         button.clearTable()
  713.  
  714.         function fillTable()
  715.             button.setTable("1",one,2,4,2,4)
  716.             button.setTable("2",two,6,8,2,4)
  717.             button.setTable("3",three,10,12,2,4)
  718.             button.setTable("4",four,14,16,2,4)
  719.             button.setTable("5",five,18,20,2,4)
  720.             button.setTable("6",six,2,4,6,8)
  721.             button.setTable("7",seven,6,8,6,8)
  722.             button.setTable("8",eight,10,12,6,8)
  723.             button.setTable("9",nine,14,16,6,8)
  724.             button.setTable("10",ten,18,21,6,8)
  725.             button.setTable("11",eleven,2,5,10,12)
  726.             button.setTable("12",twelve,7,10,10,12)
  727.             button.setTable("13",thirteen,12,15,10,12)
  728.             button.setTable("14",fourteen,17,20,10,12)
  729.             button.setTable("15",fifteen,22,25,10,12)
  730.             button.setTable("confirm",confirm,39,49,16,18)
  731.             button.screen()
  732.         end
  733.  
  734.         function getClick()
  735.             event,side,x,y = os.pullEvent("monitor_touch")
  736.             button.checkxy(x,y)
  737.         end
  738.  
  739.         function one()
  740.             button.flash("1")
  741.             if a == 0 then
  742.                 a = 1
  743.             else
  744.                 b = 1
  745.             end
  746.         end
  747.  
  748.         function two()
  749.             button.flash("2")
  750.             if a == 0 then
  751.                 a = 2
  752.             else
  753.                 b = 2
  754.             end
  755.         end
  756.  
  757.         function three()
  758.             button.flash("3")
  759.             if a == 0 then
  760.                 a = 3
  761.             else
  762.                 b = 3
  763.             end
  764.         end
  765.  
  766.         function four()
  767.             button.flash("4")
  768.             if a == 0 then
  769.                 a = 4
  770.             else
  771.                 b = 4
  772.             end
  773.         end
  774.  
  775.         function five()
  776.             button.flash("5")
  777.             if a == 0 then
  778.                 a = 5
  779.             else
  780.                 b = 5
  781.             end
  782.         end
  783.  
  784.         function six()
  785.             button.flash("6")
  786.             if a == 0 then
  787.                 a = 6
  788.             else
  789.                 b = 6
  790.             end
  791.         end
  792.  
  793.         function seven()
  794.             button.flash("7")
  795.             if a == 0 then
  796.                 a = 7
  797.             else
  798.                 b = 7
  799.             end
  800.         end
  801.  
  802.         function eight()
  803.             button.flash("8")
  804.             if a == 0 then
  805.                 a = 8
  806.             else
  807.                 b = 8
  808.             end
  809.         end
  810.  
  811.         function nine()
  812.             button.flash("9")
  813.             if a == 0 then
  814.                 a = 9
  815.             else
  816.                 b = 9
  817.             end
  818.         end
  819.  
  820.         function ten()
  821.             button.flash("10")
  822.             if a == 0 then
  823.                 a = 10
  824.             else
  825.                 b = 10
  826.             end
  827.         end
  828.  
  829.         function eleven()
  830.             button.flash("11")
  831.             if a == 0 then
  832.                 a = 11
  833.             else
  834.                 b = 11
  835.             end
  836.         end
  837.  
  838.         function twelve()
  839.             button.flash("12")
  840.             if a == 0 then
  841.                 a = 12
  842.             else
  843.                 b = 12
  844.             end
  845.         end
  846.  
  847.         function thirteen()
  848.             button.flash("13")
  849.             if a == 0 then
  850.                 a = 13
  851.             else
  852.                 b = 13
  853.             end
  854.         end
  855.  
  856.         function fourteen()
  857.             button.flash("14")
  858.             if a == 0 then
  859.                 a = 14
  860.             else
  861.                 b = 14
  862.             end
  863.         end
  864.  
  865.         function fifteen()
  866.             button.flash("15")
  867.             if a == 0 then
  868.                 a = 15
  869.             else
  870.                 b = 15
  871.             end
  872.         end
  873.  
  874.         function confirm()
  875.             button.flash("confirm")
  876.             fin = 1
  877.         end
  878.         fillTable()
  879.         button.heading("choose coordinates where container will be sent:")
  880.     while fin == 0 do
  881.         m.setCursorPos(2,14)
  882.         m.write("koordynaty - x: ",a," y: ",b)
  883.     end
  884.     redf.setAnalogOutput("east",8)
  885.     sleep(0,5)
  886.     redf.setAnalogOutput("east",0)
  887.     sleep(3)
  888.  
  889.     redf.setOutput("north",true) --blokuje os y
  890.     redf.setOutput("down",true) --blokuje os x
  891.     redconst.setOutput("down",true) --wlancza obroty suwnic
  892.     sleep(0,5)
  893.     redf.setOutput("up",true) --emiter sygnalu aktywuje ciagnacy tlok
  894.     sleep(0,5)
  895.     redf.setOutput("up",false)
  896.     sleep(2.5)
  897.     redconst.setOutput("down",false)
  898.     redf.setOutput("north",false) --odblokowuje wszystkie osie oraz wylancza obroty walu
  899.     redf.setOutput("down",false)
  900.  
  901.     --powrot do poz. pocz.
  902.     sleep(0,5)
  903.     redb.setAnalogOutput("east",8)
  904.     sleep(0,5)
  905.     redb.setAnalogOutput("east",0)
  906.  
  907.     sleep(0,5)
  908.     redf.setOutput("north",true) --blokada osi y
  909.     redf.setAnalogOutput("east",a)
  910.     sleep(0,5)
  911.     redf.setAnalogOutput("east",0)
  912.     sleep(5)
  913.     redf.setOutput("north",false) --odlokowuje os y
  914.  
  915.     sleep(0,5)
  916.     redf.setAnalogOutput("east",b)
  917.     sleep(0,5)
  918.     redf.setAnalogOutput("east",0)
  919.     sleep(3)
  920.  
  921.     sleep(0,5)
  922.     redf.setOutput("north",true) --blokada osi y
  923.     redb.setAnalogOutput("east",a)
  924.     sleep(0,5)
  925.     redb.setAnalogOutput("east",0)
  926.     sleep(5)
  927.     redf.setOutput("north",false)
  928.  
  929.     sleep(0,5)
  930.     redb.setAnalogOutput("east",b)
  931.     sleep(0,5)                          --powrot do poz. 0 0
  932.     redb.setAnalogOutput("east",0)
  933.     sleep(3)
  934.    
  935. end
  936.  
  937. fillTable()
  938. button.heading("choose action:")
  939. while true do
  940.     getClick()
  941. end
Advertisement
Add Comment
Please, Sign In to add comment