Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- clear()
- print("ACCREDITO SU CARTA")
- print("")
- print("Digitare 'a' per lettore davanti, 'd' per lettore dietro")
- local latouf = read()
- if latouf = "a" then
- local lato = "bottom"
- elseif latouf = "d" then
- local lato = "right"
- else
- print("Errore durante la selezione del lato")
- os.reboot()
- end
- m = peripheral.wrap(lato) --magcard
- lbl = "BN Credit"
- clear()
- m.setInsertCardLight(true)
- za,rawCredito = os.pullEvent("mag_swipe")
- m.setInsertCardLight(false)
- credito = tonumber(rawCredito)
- while true do
- print("La carta ha una disponibilità di "..credito.." IC.")
- print("")
- print("Inserire l'importo da accreditare")
- print("")
- local raccredito = read()
- local accredito = tonumber(raccredito)
- local nuovoCredito = credito + accredito
- local ncr = tostring(nuovoCredito)
- print("")
- print("INSERIRE LA CARTA NUOVAMENTE")
- m.setInsertCardLight(true)
- m.beginWrite(ncr,lbl)
- os.pullEvent("mag_write_done")
- m.setInsertCardLight(false)
- clear()
- print("Importo accreditato")
- print("")
- sleep(5)
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment