Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HlasLinka = "back"
- Adresa = "Jaderna Elektrarna Bostrava"
- Udalost = "POZAR"
- upresneni = "Reaktor c. 4"
- local idPC = os.getComputerID()
- modem = peripheral.wrap("top")
- modem.open(idPC)
- IDserver = 120
- local historielinka = false
- local tedlinka
- local i = 0
- local testJednotky = true
- local test = math.random(10000, 22000)
- term.clear()
- term.setCursorPos(1,1)
- print("ID ustredny: "..idPC)
- print("Adresa: "..Adresa)
- print("Cas spusteni: "..os.date())
- if (test < 11600 and testJednotky) then
- hod = math.floor(test/3600)
- minu = math.floor ((test - hod*3600)/60)
- print("Test jednotky za: "..hod.." h, "..minu.." min")
- else print ("Test jednotky nebude proveden! ("..test..")") end
- function linka()
- tedlinka = redstone.getInput(HlasLinka)
- if not (historielinka == tedlinka) then
- if tedlinka then
- poplach = true
- end
- end
- if poplach then poslatStatus() print("status odeslan!") end
- historielinka = tedlinka
- poplach = false
- sleep(1)
- i = i+1
- if (test < 11600 and (test-i) >=0 and testJednotky) then term.setCursorPos(1,5) print("Test za "..(test-i).." s") end
- if ((test-i) == 0) then upresneni = ("TC - "..upresneni) poslatStatus() print("Status odeslan!") end
- if (i==11600) then os.reboot() end
- linka()
- end
- function poslatStatus()
- modem.transmit(IDserver,990,idPC)
- modem.transmit(IDserver,57600,Adresa)
- modem.transmit(IDserver,57601,Udalost)
- modem.transmit(IDserver,57602,upresneni)
- end
- linka()
Advertisement
Add Comment
Please, Sign In to add comment