Posted 21 December 2013 - 10:38 AM
So I have been working on this program for ages, what it does is use analogue redstone signals to send messages, but the issue I have been having is that the print (at the end, print(string.char(timer))) isn't happening and I'm not sure why! It works by converting the ascii code for the letter into a redstone delay which will be read by another computer. Here is my code:
while(true) do
local timer=0
local event, param = os.pullEvent()
if event == 'key' then
if param == keys.enter then
local s=read()
print(s)
for a = 1, string.len(s) do
print(string.sub(s,a,a))
rs.setOutput("back",true)
print(tostring(string.byte(string.sub(s,a,a))/10))
sleep(string.byte(string.sub(s,a,a))/10)
rs.setOutput("back",false)
sleep(1)
end
if param ==keys.f4 then
return
end
if rs.getInput("right")==true then
while(rs.getInput("right"))==true do
timer=timer+1
sleep(0.1)
end
print(string.char(timer))
timer=0
end
end
end
end
Edited on 21 December 2013 - 01:26 PM