Advertisement
blawhar

Untitled

Nov 1st, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.95 KB | None | 0 0
  1. function variables()
  2.   rednet.open("top")
  3.   out1=peripheral.wrap("flux_gate_79")
  4.   in1=peripheral.wrap("flux_gate_78")
  5.   cap1=peripheral.wrap("draconic_rf_storage_16")
  6.   isCap1={empty=false,full=false,outp=false,inp=false,c=false}
  7.   maxIn=60000000
  8.   maxOut=5000000
  9.  
  10.  lot=1640000000
  11.  
  12.   koupeno=0
  13.   preneseno=0
  14. --  prenesenoStr  
  15.   pass=0
  16.   pass1=0
  17.   ipass=0
  18.  
  19.   start=false
  20.   cBuy=0
  21.   cCount=0
  22.   gate=true
  23.   isOpened=false
  24.   btnGate=0
  25.   mainScreenGate=false
  26.   passGate=false
  27.  
  28.   count=0
  29.   ID=2284
  30.   price=10
  31.  
  32.  
  33.   redstone.setOutput("left",true)
  34.   sleep(1)
  35.   redstone.setOutput("left",false)
  36.  
  37. end
  38.  
  39. function formatInt(number)
  40.   if number == nil then number = 0 end
  41.   local i,j,minus,int,fraction=tostring(number):find('([-]?)(%d+)([.]?%d*)')
  42.   int=int:reverse():gsub("(%d%d%d)","%1,")
  43.   return minus .. int:reverse():gsub("^,","") .. fraction
  44. end
  45.  
  46.    
  47. function getAllVariables()
  48.  local data=fs.open("cap1.txt","r")
  49.  isCap1.empty=data.readLine()
  50.  isCap1.full=data.readLine()
  51.  isCap1.outp=data.readLine()
  52.  isCap1.inp=data.readLine()
  53.  isCap1.c=data.readLine()
  54.  data.close()
  55.  
  56.  
  57.  local data=fs.open("gates.txt","r")
  58.  gate=data.readLine()
  59.  isOpened=data.readLine()
  60.  mainScreenGate=data.readLine()
  61.  data.close()
  62.  
  63.  local data=fs.open("pass.txt","r")
  64.  pass=data.readLine()
  65.  data.close()
  66.  
  67.  local data=fs.open("another.txt","r")
  68.  start=data.readLine()
  69.  cBuy=data.readLine()
  70.  count=data.readLine()
  71.  data.close()
  72.  
  73.  local data=fs.open("btnGate.txt","r")
  74.  btnGate=data.readLine()
  75.  data.close()  
  76.  
  77. end
  78.  
  79. function updateCap1()
  80.   local data=fs.open("cap1.txt","w")
  81.   data.writeLine(isCap1.empty)
  82.   data.writeLine(isCap1.full)
  83.   data.writeLine(isCap1.outp)
  84.   data.writeLine(isCap1.inp)
  85.   data.writeLine(isCap1.c)
  86.   data.close()
  87. end
  88.  
  89.  
  90.  
  91. function gatesUpdate()
  92.   local data=fs.open("gates.txt","w")
  93.   data.writeLine(gate)
  94.   data.writeLine(isOpened)
  95.   data.writeLine(mainScreenGate)
  96.   data.close()
  97. end
  98.  
  99. function passUpdate()
  100.   local data=fs.open("pass.txt","w")
  101.   data.writeLine(pass)
  102.   data.close()
  103. end
  104.  
  105. function anotherUpdate()
  106.   local data=fs.open("another.txt","w")
  107.   data.writeLine(start)
  108.   data.writeLine(cBuy)
  109.   data.writeLine(count)
  110.   data.close()
  111. end
  112.  
  113. function btnGateUpdate()
  114.   local data=fs.open("btnGate.txt","w")
  115.   data.writeLine(btnGate)
  116.   data.close()
  117.  
  118. end
  119.  
  120. function monClear()
  121.   mon.setBackgroundColor(colors.black)
  122.   mon.clear()
  123.   mon.setCursorPos(1,1)
  124.   mon.setTextColour(colors.white)
  125. end  
  126.  
  127. function monSetup()
  128.   mon=peripheral.wrap("monitor_141")
  129.   mon.setBackgroundColor(colors.black)
  130.   mon.clear()
  131. end
  132.  
  133. function monWrite(ax,ay,tColor,BgColor,atext)
  134.   mon.setBackgroundColor(BgColor)
  135.   mon.setTextColour(tColor)
  136.   mon.setCursorPos(ax,ay)
  137.   mon.write(atext)
  138. end
  139.  
  140. function firstScreen()
  141.   btnGate=1
  142.   monSetup()
  143.   monWrite(10,1,colors.red,colors.black,"TERMINAL #1")
  144.   monWrite(7,3,colors.blue,colors.black,"Max out:")
  145.   monWrite(16,3,colors.white,colors.black,"5")
  146.   monWrite(18,3,colors.purple,colors.black,"MRF/t")
  147.   monWrite(7,5,colors.orange,colors.black,"1 lot:")
  148.   monWrite(14,5,colors.white,colors.black,"1,64")
  149.   monWrite(19,5,colors.purple,colors.black,"BRF")
  150.   monWrite(4,7,colors.red,colors.black,"Price:")
  151.   monWrite(11,7,colors.white,colors.black,"10")
  152.   monWrite(14,7,colors.purple,colors.black,"Dia block/lot")
  153.   monWrite(7,11,colors.white,colors.red,"OTEVRIT PRIPOJKU")
  154.  while true do
  155.   os.pullEvent()
  156.   if btnGate==0 then
  157.     return
  158.   end
  159.  end
  160.  
  161. end
  162.  
  163. function firstInfo()
  164.   btnGate=2
  165.   monClear()
  166.   monWrite(1,1,colors.white,colors.black,"Testovaci provoz. Majtel si")
  167.   monWrite(1,2,colors.white,colors.black,"vyhrazje pravo rusit/upravit")
  168.   monWrite(1,3,colors.white,colors.black,"bez vaseho vedomi. jakykoliv")
  169.   monWrite(1,4,colors.white,colors.black,"pokus o obchazeni systemu se")
  170.   monWrite(1,5,colors.white,colors.black,"tresta. pokud nebude 30 dnu")
  171.   monWrite(1,6,colors.white,colors.black,"aktivni output, pripojka se")
  172.   monWrite(1,7,colors.white,colors.black,"automaticky maze.")
  173.   monWrite(1,11,colors.white,colors.black,"Pokud souhlasis, klikni na:")
  174.   monWrite(18,12,colors.white,colors.green,"SOUHLASIM")
  175.  while true do
  176.   os.pullEvent()
  177.   if btnGate==0 then
  178.     return
  179.   end    
  180.  end
  181. end
  182.  
  183. function passInfo()
  184.   btnGate=3
  185.   monClear()
  186.   monWrite(1,3,colors.white,colors.black,"Kvuli zabezpeceni bude v")
  187.   monWrite(1,4,colors.white,colors.black,"nasledujicim kroku zadano")
  188.   monWrite(1,5,colors.white,colors.black,"4 mistne heslo. Toto heslo")
  189.   monWrite(1,6,colors.white,colors.black,"bude pozdeji pozadovano pri")
  190.   monWrite(1,7,colors.white,colors.black,"zmenach parametru pripojky")
  191.  
  192.   monWrite(1,12,colors.white,colors.black,"pro zadani hesla stiskni")
  193.   monWrite(26,12,colors.white,colors.green,"OK")
  194.  while true do
  195.   os.pullEvent()
  196.   if btnGate == 0 then
  197.     return
  198.   end  
  199.  end
  200. end
  201.  
  202. function firstPass()
  203.   btnGate=4
  204.  
  205.   while true do
  206.     monClear()
  207.     keyboardPrint()
  208.     passGate=true
  209.     zadejPass(1)
  210.     while passGate do
  211.       os.pullEvent()
  212.     end
  213.     pass=pass1
  214.     pass1=0
  215.    
  216.     passGate=true  
  217.     monClear()
  218.     keyboardPrint()
  219.     ipass=0
  220.     zadejPass(3)
  221.     while passGate do
  222.       os.pullEvent()
  223.     end
  224.     if pass==pass1 then
  225.       --printClearWindow()
  226.       --printToWindow(....)
  227.       --mainScreenGate=true
  228.       pass1=0
  229.       btnGate=0
  230.       isOpened=true
  231.       ipass=0
  232.       return
  233.     else
  234.       --printClearWindow()
  235.       printToWindow()
  236.       pass=0
  237.       ipass=0
  238.       pass1=0      
  239.     end
  240.   end
  241. end
  242.  
  243. function getPass()
  244.   btnGate=4
  245.  
  246.   while true do
  247.  
  248.    
  249.     passGate=true  
  250.     monClear()
  251.     keyboardPrint()
  252.     ipass=0
  253.     zadejPass(2)
  254.     while passGate do
  255.       os.pullEvent()
  256.     end
  257.     if pass==pass1 then
  258.       --printClearWindow()
  259.       --printToWindow(....)
  260.       mainScreenGate=true
  261.       pass1=0
  262.       btnGate=0
  263.       ipass=0
  264.       return
  265.     else
  266.       --printClearWindow()
  267.       printToWindow()
  268.       ipass=0
  269.       pass1=0      
  270.     end
  271.   end
  272. end
  273.  
  274.  
  275. --function printClearWindow()
  276.  
  277. --end
  278.  
  279. function printToWindow() --predelat
  280. monClear()
  281. monWrite(1,1,colors.white,colors.black,"CHYBA!")
  282. monWrite(1,2,colors.white,colors.black,"Hesla se neshoduji")
  283. monWrite(1,3,colors.white,colors.black,"opakuj proces")
  284. sleep(4)
  285. end
  286.  
  287.  
  288. function Loader(x)--dodelat
  289.  
  290. if x==1 then
  291. getPass()
  292.  
  293. end
  294.  
  295. btnGate=5
  296.  
  297. monClear()
  298. if x==0 then
  299. monWrite(1,1,colors.white,colors.black,"na cerveny blok poloz ")
  300. monWrite(1,2,colors.white,colors.black,"tesseract, na cerny naplneny")
  301. monWrite(1,3,colors.white,colors.black,"chunkoader* a potvrd")
  302.  
  303. monWrite(1,6,colors.white,colors.black,"* Chunkloader neni nutny,")
  304. monWrite(1,7,colors.white,colors.black,"ale...")
  305.  
  306. monWrite(5,11,colors.white,colors.green,"OK")
  307. monWrite(10,11,colors.white,colors.green,"CANCEL")
  308. else
  309. monWrite(1,1,colors.white,colors.black,"vysunul jsi loader")
  310. monWrite(1,2,colors.white,colors.black,"pro zasunuti stiskni ok")
  311.  
  312. monWrite(5,11,colors.white,colors.green,"OK")
  313.  
  314.  
  315. end
  316.  
  317. redstone.setOutput("bottom",true)
  318. sleep(1)
  319. redstone.setOutput("bottom",false)
  320.  
  321.  
  322.  
  323.  
  324. while true do
  325.  os.pullEvent()
  326.  if btnGate==0 then
  327.    return
  328.  end
  329. end
  330.  
  331. end
  332.  
  333. function buy(x)
  334. if x==1 then
  335. getPass()
  336. end
  337.  
  338.  
  339. btnGate=10
  340. mainScreenGate=false
  341. monClear()
  342. monWrite(1,1,colors.white,colors.black,"vhod dia do crate a potvrd")
  343. monWrite(1,2,colors.white,colors.black,"prepocet chvilku trva,")
  344. monWrite(1,3,colors.white,colors.black,"prosim o strpeni")
  345. monWrite(13,11,colors.white,colors.green,"OK")
  346.  
  347. while true do
  348.   eID,msg,dist=rednet.receive()
  349.   if eID==ID then
  350.   count=tonumber(msg)
  351.   print(count)
  352.   print(msg)
  353.   btnGate=11
  354.   break
  355.   end
  356. end
  357. vratit=(count-math.floor(count/price)*price)
  358. zaplaceno=(math.floor(count/price))*price
  359. koupeno=koupeno+lot*(zaplaceno/price)
  360. cBuy=cBuy+(zaplaceno/price)
  361.  
  362. print(vratit)
  363. print(zaplaceno)
  364.  
  365. monClear()
  366. monWrite(1,1,colors.white,colors.black,"zaplaceno:")
  367. monWrite(1,2,colors.white,colors.black,tostring(zaplaceno))
  368. monWrite(1,3,colors.white,colors.black,"vraceno:")
  369. monWrite(1,4,colors.white,colors.black,tostring(vratit))
  370. monWrite(1,5,colors.white,colors.black,"koupeno nergie:")
  371. monWrite(1,6,colors.lightGray,colors.black,formatInt(lot*(zaplaceno/price)))
  372. monWrite(5,11,colors.white,colors.green,"OK")
  373. monWrite(10,11,colors.white,colors.red,"CANCEL")
  374.  
  375. while true do
  376.  os.pullEvent()
  377.  if btnGate==0 then
  378.    return
  379.  end
  380. end
  381.  
  382.  
  383. end
  384.  
  385.  
  386.  
  387. function mainScreen()
  388.  -- monClear()
  389.  
  390. --  prenesenoProc=(preneseno/koupeno)*100
  391.  
  392. --  preneseno=cCount*1640000000
  393.  
  394.   if isCap1.outp  then
  395.        preneseno=(cCount)*1640000000+(1640000000-cap1.getEnergyStored())
  396.  -- sleep(1)
  397.   else
  398.     preneseno=cCount*1640000000
  399.  -- sleep(1)
  400.   end  
  401.  
  402.  monClear()
  403.   monWrite(5,3,colors.white,colors.black,"koupeno")
  404.   monWrite(1,4,colors.lightGray,colors.black,formatInt(koupeno))
  405.   monWrite(3,6,colors.white,colors.black,"preneseno")
  406.   monWrite(1,7,colors.lightGray,colors.black,formatInt(preneseno))
  407.  
  408.   monWrite(19,2,colors.white,colors.green," dokoupit ")
  409.   monWrite(19,3,colors.white,colors.green," energii  ")
  410.  
  411.   monWrite(19,5,colors.white,colors.green," vysunout ")
  412.   monWrite(19,6,colors.white,colors.green," ch.loader")
  413.  
  414.   monWrite(19,8,colors.white,colors.green,"   help   ")
  415.  
  416.   monWrite(19,10,colors.white,colors.red,"  zrusit  ")
  417.   monWrite(19,11,colors.white,colors.red," pripojku ")
  418.  
  419. end
  420.  
  421. function zadejPass(x)
  422.   mon.setTextColor(colors.white)
  423.   mon.setBackgroundColor(colors.black)
  424.   if x==1 then  
  425.       mon.setCursorPos(11,2)
  426.       mon.write("zadej 4 mistne")
  427.       mon.setCursorPos(11,3)  
  428.       mon.write("heslo a potvrd OK")
  429.   elseif x==2 then
  430.       mon.setCursorPos(11,2)
  431.       mon.write("              ")
  432.       mon.setCursorPos(11,2)
  433.       mon.write("zadej heslo")
  434.       mon.setCursorPos(11,3)
  435.       mon.write("a potvrd OK")
  436.   elseif x==3 then
  437.       mon.setCursorPos(11,2)
  438.       mon.write("              ")
  439.       mon.setCursorPos(11,2)
  440.       mon.write("potvrd heslo")
  441.       mon.setCursorPos(11,3)
  442.       mon.write("a potvrd OK")
  443.   end
  444. end
  445.  
  446. function keyboardPrint()
  447.   monClear()
  448.   mon.setBackgroundColour(colors.blue)
  449.   mon.setCursorPos(2,1)
  450.   mon.write("  ")
  451.   mon.setCursorPos(5,1)
  452.   mon.write("  ")
  453.   mon.setCursorPos(8,1)
  454.   mon.write("  ")
  455.   mon.setCursorPos(2,2)
  456.   mon.write("7 ")
  457.   mon.setCursorPos(5,2)
  458.   mon.write("8 ")
  459.   mon.setCursorPos(8,2)
  460.   mon.write("9 ")
  461.  
  462.   mon.setCursorPos(2,4)
  463.   mon.write("  ")
  464.   mon.setCursorPos(5,4)
  465.   mon.write("  ")
  466.   mon.setCursorPos(8,4)
  467.   mon.write("  ")  
  468.   mon.setCursorPos(2,5)
  469.   mon.write("4 ")
  470.   mon.setCursorPos(5,5)
  471.   mon.write("5 ")
  472.   mon.setCursorPos(8,5)
  473.   mon.write("6 ")
  474.  
  475.   mon.setCursorPos(2,7)
  476.   mon.write("  ")
  477.   mon.setCursorPos(5,7)
  478.   mon.write("  ")
  479.   mon.setCursorPos(8,7)
  480.   mon.write("  ")
  481.   mon.setCursorPos(2,8)
  482.   mon.write("1 ")
  483.   mon.setCursorPos(5,8)
  484.   mon.write("2 ")
  485.   mon.setCursorPos(8,8)
  486.   mon.write("3 ")
  487.  
  488.   mon.setCursorPos(2,10)
  489.   mon.write("  ")
  490.   mon.setCursorPos(2,11)
  491.   mon.write("0 ")
  492.   mon.setCursorPos(5,10)
  493.   mon.setBackgroundColor(colors.lime)
  494.   mon.write("  ")
  495.   mon.setCursorPos(5,11)
  496.   mon.write("OK")
  497.   mon.setCursorPos(8,10)
  498.   mon.setBackgroundColor(colors.red)
  499.   mon.write("  ")
  500.   mon.setCursorPos(8,11)
  501.   mon.write("DL")
  502.  
  503.   mon.setCursorPos(28,11)
  504.   mon.write("  ")
  505.   mon.setCursorPos(28,12)
  506.   mon.write("X ")
  507.  
  508.   mon.setBackgroundColor(colors.black)
  509.   mon.setCursorPos(11,5)
  510.   mon.write("PASS:")
  511. end
  512.  
  513.  
  514. function buttons()
  515.   while true do
  516.     event, side, x, y=os.pullEvent("monitor_touch")
  517.     if btnGate==1 then
  518.       if x>6 and x<19 and y==11 then    
  519.         btnGate=0
  520.       end
  521.     elseif btnGate==2 then
  522.       if x>17 and x<27 and y==12 then    
  523.         btnGate=0
  524.       end
  525.     elseif btnGate==3 then
  526.       if x>25 and x<28 and y==12 then
  527.         btnGate=0
  528.      
  529.       end
  530.     elseif btnGate==4 then
  531.       if x>1 and x<4 and y<3 and ipass<4 then
  532.         pass1=pass1*10+7
  533.         mon.setCursorPos(16+ipass,5)
  534.         mon.write("*")
  535.         ipass=ipass+1
  536.       elseif x>4 and x<7 and y<3 and ipass<4 then
  537.         pass1=pass1*10+8
  538.         mon.setCursorPos(16+ipass,5)
  539.         mon.write("*")
  540.         ipass=ipass+1
  541.       elseif x>7 and x<10 and y<3 and ipass<4 then
  542.         pass1=pass1*10+9
  543.         mon.setCursorPos(16+ipass,5)
  544.         mon.write("*")
  545.         ipass=ipass+1
  546.       elseif x>1 and x<4 and y>3 and y<6 and ipass<4 then
  547.         pass1=pass1*10+4
  548.         mon.setCursorPos(16+ipass,5)
  549.         mon.write("*")
  550.         ipass=ipass+1
  551.       elseif x>4 and x<7 and y>3 and y<6 and ipass<4 then
  552.         pass1=pass1*10+5
  553.         mon.setCursorPos(16+ipass,5)
  554.         mon.write("*")
  555.         ipass=ipass+1
  556.       elseif x>7 and x<10 and y>3 and y<6 and ipass<4 then
  557.         pass1=pass1*10+6
  558.         mon.setCursorPos(16+ipass,5)
  559.         mon.write("*")
  560.         ipass=ipass+1
  561.       elseif x>1 and x<3 and y>6 and y<9 and ipass<4 then
  562.         pass1=pass1*10+1
  563.         mon.setCursorPos(16+ipass,5)
  564.         mon.write("*")
  565.         ipass=ipass+1
  566.       elseif x>3 and x<7 and y>6 and y<9 and ipass<4 then
  567.         pass1=pass1*10+2
  568.         mon.setCursorPos(16+ipass,5)
  569.         mon.write("*")
  570.         ipass=ipass+1
  571.       elseif x>7 and x<10 and y>6 and y<9 and ipass<4 then
  572.         pass1=pass1*10+3
  573.         mon.setCursorPos(16+ipass,5)
  574.         mon.write("*")
  575.         ipass=ipass+1
  576.       elseif x>1 and x<4 and y>9 and y<12 and ipass<4 then
  577.         pass1=pass1*10+0
  578.         mon.setCursorPos(16+ipass,5)
  579.         mon.write("*")
  580.         ipass=ipass+1
  581.       elseif x>7 and x<10 and y>9 and y<12 then
  582.         if ipass>0 then
  583.           pass1=math.floor(pass1/10)
  584.           ipass=ipass-1
  585.           mon.setCursorPos(16+ipass,5)
  586.           mon.write(" ")
  587.         end
  588.       elseif x>4 and x<7 and y>9 and y<12 and ipass==4 then
  589.  
  590.         passGate=false
  591.  
  592.      
  593.       end
  594.     elseif btnGate==5 then
  595.       if x>4 and x<8 and y==11 then
  596.         btnGate=0
  597.      redstone.setOutput("left",true)
  598.         sleep(1)
  599.            redstone.setOutput("left",false)
  600.       end
  601.     elseif btnGate==10 then
  602.       if x>10 and x<14 and y==11 then
  603.         rednet.send(ID,1)
  604.      mainScreenGate=true
  605.      --if start==false and cBuy>0 then
  606.          -- start=true
  607.          -- gate=true
  608.     -- end
  609.    end
  610.     elseif btnGate==11 then
  611.       if x>4 and x<8 and y==11 then
  612.         rednet.send(ID,3)
  613.            btnGate=0
  614.      mainScreenGate=true
  615.      if start==false and cBuy>0 then
  616.      start=true
  617.      end
  618.         --start=true
  619.       elseif x>9 and x<17 and y==11 then
  620.         rednet.send(ID,2)
  621.            btnGate=0
  622.      mainScreenGate=true
  623.       end
  624.     elseif btnGate==0 then
  625.       if x>18 and x<29 and y>1 and y<4 then
  626.       btnGate=10
  627.       elseif x>18 and x<29 and y>4 and y<7 then
  628.    btnGate=5
  629.    end
  630.      
  631.      
  632.  end  
  633.     sleep(0.1)
  634.   end
  635. end
  636.  
  637. function disp()
  638. while true do
  639.  
  640.     term.clear()
  641.     term.setCursorPos(1,1)
  642.     print("pass: "..pass)
  643.     print("start: "..(start and 'true' or 'false'))
  644.     print("gate: "..(gate and 'true' or 'false'))
  645.     print("cap1:empty:"..(isCap1.empty and 'true' or 'false').." ,full:"..(isCap1.full and 'true' or 'false').." ,outp:"..(isCap1.outp and 'true' or 'false').." ,inp:"..(isCap1.inp and 'true' or 'false'))
  646.     print("cBuy: "..cBuy.." ,cCount: "..cCount)
  647.  
  648.  
  649.  
  650.     if not isOpened then
  651.       firstScreen()
  652.       firstInfo()
  653.       passInfo()
  654.       firstPass()
  655.       buy(0)
  656.       Loader(0)
  657.    
  658.    else
  659.      if mainScreenGate then
  660.        mainScreen()
  661.      end
  662.    if btnGate==10 then
  663.      buy(1)
  664.    elseif btnGate==5 then
  665.      Loader(1)
  666.    end
  667.    
  668.    end
  669.  
  670.     sleep(0.1)
  671.   end
  672. end
  673.  
  674.  
  675. function capReg()
  676.   while true do
  677.  
  678.  
  679.  
  680.  if start then
  681.       if gate then
  682.        -- cCount=0
  683.         isCap1.outp=true
  684.        -- output.setSignalLowFlow(maxOut)
  685.         gate=false
  686.       end
  687.     else  
  688.       --output.setSignalLowFlow(0)
  689.     end
  690.  ------------
  691.  
  692.   -- cap1 empty/full  begin
  693.     if cap1.getEnergyStored()==cap1.getMaxEnergyStored() then
  694.       isCap1.full=true
  695.     else
  696.       isCap1.full=false
  697.     end
  698.  
  699.     if cap1.getEnergyStored()==0 then
  700.       isCap1.empty=true
  701.     else
  702.       isCap1.empty=false
  703.     end    
  704.  
  705. -- cap1 empty/full  end
  706.  
  707. --cap1 set in/out flow begin
  708.     if isCap1.outp then
  709.       out1.setSignalLowFlow(maxOut)
  710.     else
  711.       out1.setSignalLowFlow(0)
  712.     end  
  713.    
  714.        
  715.     if isCap1.inp then
  716.       in1.setSignalLowFlow(maxIn)
  717.     else
  718.       in1.setSignalLowFlow(0)
  719.     end
  720.    
  721.  
  722.     if isCap1.empty and isCap1.outp then
  723.       isCap1.outp=false
  724.       isCap1.c=true
  725.     end
  726.    
  727.     if isCap1.full and isCap1.inp then
  728.       isCap1.inp=false
  729.     end
  730.    
  731. -- cap1 fill/unfill start/stop begin
  732. --fill
  733.     if isCap1.empty and not isCap1.outp then
  734.       isCap1.inp=true
  735.     end
  736. --unfill
  737.     if isCap1.full and not isCap1.inp and start then
  738.       isCap1.outp=true
  739.    count=count+1
  740.     end
  741.  
  742. -- cap1 fill/unfill start/stop end
  743.    
  744.   sleep(0.1)
  745.  
  746.  
  747.  --------
  748.  
  749.  
  750.  
  751.  
  752.   end  
  753. end
  754.  
  755.  
  756. variables()
  757.  
  758. --updateCap1()
  759. --gatesUpdate()
  760. --passUpdate()
  761. --anotherUpdate()
  762. --btnGateUpdate()
  763.  
  764. --getAllVariables()
  765.  
  766. parallel.waitForAny(buttons,disp,capReg)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement