Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modem_pos = "front"
- deviatoi_pos = "top"
- partenza_pos = "left"
- stati_pos = "right"
- protezioni_pos = "bottom"
- rednet.open(modem_pos)
- -- Costanti
- -- >> BINARI
- binari = {[colors.lime] = false, [colors.yellow] = false, [colors.lightBlue] = false, [colors.magenta] = false, [colors.orange] = false, [colors.white] = false, [colors.pink] = false, [colors.gray] = false}
- function getTrackStatus()
- for k, v in pairs(binari) do
- print(k)
- binari[k] = rs.testBundledInput(stati_pos, k)
- end
- end
- function executeOrders(data, tableName, side)
- if data ~= nil and data[tableName] ~= nil then
- rs.setBundledOutput(side, data[tableName])
- end
- end
- term.clear()
- term.setCursorPos(1, 1)
- print("ACC v1.0 [ATTUATORE] by FoxWorn3365 -- (C) 2025 ALSTOM\n\n")
- -- Il programma lavora in sync con il computer del QlV
- -- Il messaggio deve contenere le istruzioni per TUTTO e noi come risposta inviamo le info dei binari occupati
- while true do
- print("[INFO] Awaiting message...")
- local sender, message = rednet.receive()
- if message ~= "" then
- local orders = textutils.unserialize(message)
- if #orders >= 1 then
- print("[INFO] Executing orders...")
- executeOrders(orders, "deviatoi", deviatoi_pos)
- executeOrders(orders, "partenza", partenza_pos)
- executeOrders(orders, "protezioni", protezioni_pos)
- end
- end
- print("[INFO] Sending CdB status list...")
- getTrackStatus()
- rednet.send(sender, textutils.serialize(binari))
- end
Advertisement
Add Comment
Please, Sign In to add comment