Posted 11 September 2012 - 01:44 PM
Hey everyone, I had a bit of a dumb question no doubt but I have been stuck for most of a day with this. I'm trying to write a simple code for an elevator, with one computer being on the platform itself able to send commands to a receiving terminal that does the actual moving of the elevator, I've gotten the programs to move the elevator to work in a program called "Up" and one called "Down" the problem however lies in the receiving terminal, I can't get it to receive the proper message to move the elevator. Just for overkills sake I'll post all of the code I've written so far any help is welcome! :D/>/>
Up program
for x = 1, 11, 1 do
rs.setBundledOutput("bottom", 1)
os.sleep(0.4)
rs.setBundledOutput("bottom", 0)
os.sleep(0.4)
end
Down Program
for x = 1, 11, 1 do
rs.setBundledOutput("bottom", 2)
os.sleep(0.4)
rs.setBundledOutput("bottom", 0)
os.sleep(0.4)
end
Wireless program
term.setCursorPos(1,1)
print("Wireless mode on")
rednet.open("back")
while message ~= "Quit" do
message = rednet.receive(message)
term.write(message)
if message == "Up" then
shell.run("Up")
print("Going up!")
end
end
term.clear()
Edit: In case it's needed, I also written an Elevator program with the Up and Down as functions
for x = 1, 11, 1 do
rs.setBundledOutput("bottom", 1)
os.sleep(0.4)
rs.setBundledOutput("bottom", 0)
os.sleep(0.4)
end
end
function Down()
for x = 1, 11, 1 do
rs.setBundledOutput("bottom", 2)
os.sleep(0.4)
rs.setBundledOutput("bottom", 0)
os.sleep(0.4)
end
end
Up program
Spoiler
os.sleep(2)for x = 1, 11, 1 do
rs.setBundledOutput("bottom", 1)
os.sleep(0.4)
rs.setBundledOutput("bottom", 0)
os.sleep(0.4)
end
Down Program
Spoiler
os.sleep(2)for x = 1, 11, 1 do
rs.setBundledOutput("bottom", 2)
os.sleep(0.4)
rs.setBundledOutput("bottom", 0)
os.sleep(0.4)
end
Wireless program
Spoiler
term.clear()term.setCursorPos(1,1)
print("Wireless mode on")
rednet.open("back")
while message ~= "Quit" do
message = rednet.receive(message)
term.write(message)
if message == "Up" then
shell.run("Up")
print("Going up!")
end
end
term.clear()
Edit: In case it's needed, I also written an Elevator program with the Up and Down as functions
Spoiler
function Up()for x = 1, 11, 1 do
rs.setBundledOutput("bottom", 1)
os.sleep(0.4)
rs.setBundledOutput("bottom", 0)
os.sleep(0.4)
end
end
function Down()
for x = 1, 11, 1 do
rs.setBundledOutput("bottom", 2)
os.sleep(0.4)
rs.setBundledOutput("bottom", 0)
os.sleep(0.4)
end
end