CCCPaste

Cable debug

-- bundled_debug.lua
-- Quick probe for bundled input on a given side

local SIDE = "bottom"  -- change this to whatever side your bundled cable is on

local COLORS = {
  white   = colors.white,
  orange  = colors.orange,
  magenta = colors.magenta,
  lightBlue = colors.lightBlue,
  yellow  = colors.yellow,
  lime    = colors.lime,
  pink    = colors.pink,
  gray    = colors.gray,
  lightGray = colors.lightGray,
  cyan    = colors.cyan,
  purple  = colors.purple,
  blue    = colors.blue,
  brown   = colors.brown,
  green   = colors.green,
  red     = colors.red,
  black   = colors.black,
}

while true do
  local mask = rs.getBundledInput(SIDE)
  term.clear()
  term.setCursorPos(1,1)
  print("Bundled side:", SIDE)
  print("Raw mask: ", mask)

  for name, col in pairs(COLORS) do
    local state = colors.test(mask, col) and "ON " or "off"
    print(string.format("%-10s : %s", name, state))
  end

  sleep(0.5)
end