Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Addebito POS V2 lego11
- --VARIABILI
- local lbl = "BN Credit"
- local tabr = {}
- local mon = peripheral.wrap("left")
- mon.setTextScale(0.5)
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- mon.clear()
- mon.setCursorPos(1,1)
- end
- function monLinea1()
- mon.setCursorPos(1, 1)
- end
- function monLinea2()
- mon.setCursorPos(1, 2)
- end
- function monLinea3()
- mon.setCursorPos(1, 3)
- end
- function monLinea4()
- mon.setCursorPos(1, 4)
- end
- function cartaNonValida()
- clear()
- mon.write("Carta")
- monLinea2()
- mon.write("non")
- monLinea3()
- mon.write("valida!")
- print("Carta non valida o corrotta.")
- print("")
- print("Premere un tasto per uscire")
- os.pullEvent("key")
- clear()
- exit()
- end
- function cartaVuota()
- clear()
- mon.write("Carta")
- monLinea2()
- mon.write("vuota!")
- print("Carta smagnetizzata o vuota.")
- print("")
- print("Premere un tasto per uscire")
- os.pullEvent("key")
- clear()
- exit()
- end
- m = peripheral.wrap("right")
- clear()
- print("Verifica SALDO")
- print("")
- print("Inserire la carta")
- mon.write("Saldo:")
- monLinea2()
- mon.write("inserire")
- monLinea3()
- mon.write("la carta")
- m.setInsertCardLight(true)
- za,rawcarta = os.pullEvent("mag_swipe")
- m.setInsertCardLight(false)
- if rawcarta == nil then
- cartaVuota()
- end
- tab = textutils.unserialize(rawcarta)
- if type(tab) ~= "table" then
- cartaNonValida()
- end
- if tab.t ~= "cc" then
- cartaNonValida()
- end
- if tab.e ~= "BN" then
- cartaNonValida()
- end
- credito = tonumber(tab.v)
- clear()
- print("La carta ha un saldo di "..credito.." IC.")
- mon.write("Saldo carta:")
- monLinea2()
- mon.write(credito.." IC")
- monLinea3()
- print("")
- print("Premere un tasto per uscire")
- os.pullEvent("key")
- clear()
- exit()
Advertisement
Add Comment
Please, Sign In to add comment