Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- test reciver
- ]]--
- local function findDevice(sType)
- for _,sSide in pairs(rs.getSides()) do
- if peripheral.isPresent(sSide) and peripheral.getType(sSide) == sType then
- return sSide,peripheral.wrap(sSide)
- end
- end
- end
- local function dec2hex(nInput)
- return string.format("%X",tonumber(nInput))
- end
- local function hex2dec(sInput)
- return tonumber(sInput,10)
- end
- local function draw(sInput)
- for a = 0,15 do
- term.setCursorPos(1,a + 1)
- term.setBackgroundColor(colors.black)
- term.write(dec2hex(a).." ")
- for b = 0,15 do
- -- local char = string.sub(sInput,(a*16) + b + 1,(a*16) + b + 1)
- local dec = string.byte(sInput,(a*16) + b + 1)
- term.setBackgroundColor(colors.blue)
- term.write(string.char(dec))
- term.setBackgroundColor(colors.black)
- if dec ~= ((a*16) + b ) then
- term.setBackgroundColor(colors.red)
- end
- local sPart = dec2hex(dec)
- if #sPart == 1 then
- term.write(" ")
- end
- term.write(sPart)
- --[[
- term.write(tostring((a*16) + b + 1).." ")
- local char = string.char((a*16) + b)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.lime)
- term.write(char)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.gray)
- term.write(dec2hex(a)..dec2hex(b))
- table.insert(sOut,char)
- ]]--
- end
- end
- end
- local sSide,modem = findDevice("modem")
- modem.open(255)
- while true do
- local event = {os.pullEvent()}
- if event[1] == "modem_message" then
- draw(event[5])
- --[[local file = fs.open("data","w")
- file.write(event[5])
- file.close()]]--
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement