Jump to content




[Lua] Receiveing command through rednet and running program

wireless turtle networking

7 replies to this topic

#1 Xenophon

  • New Members
  • 3 posts

Posted 14 January 2013 - 10:07 AM

Hi

I am trying to send command via rednet from computer (ex. go up 1) to wireless turtle, and then have turtle run program named same as command.d
Turtle should run program "go up 1" when computer sends it message "go up 1" and run program "go down 2" when computer sends it message "go down 2".

Computer code:
rednet.open("left")
rednet.send(6,read())

Turtle code:
rednet.open("right")
id, message = rednet.receive()


#2 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 14 January 2013 - 10:16 AM

shell.run(message)


#3 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 14 January 2013 - 10:20 AM

rednet.send(id, message)

P1, p2, p3 = rednet.receive()
Shell l.run("p2")


#4 Xenophon

  • New Members
  • 3 posts

Posted 14 January 2013 - 10:29 AM

Turtle says no such program after it received command "go up 1" from computer.
Used code on turtle:

rednet.open("right")
id,message=rednet.receive()
shell.run(message)


#5 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 14 January 2013 - 10:39 AM

View PostXenophon, on 14 January 2013 - 10:29 AM, said:

Turtle says no such program after it received command "go up 1" from computer.
Used code on turtle:

rednet.open("right")
id,message=rednet.receive()
shell.run(message)

Are you sending exactly and only 'go up 1'
It should work, if it says no such program, then there's no go program on the turtle

#6 Xenophon

  • New Members
  • 3 posts

Posted 14 January 2013 - 10:46 AM

First I run program on turtle for receiving command, then one on computer for sending, after running it it asks me for input in which I type "go up 1" without quotation, then I leave it and right click turtle where it says No such program.

EDIT

Using command on turtle directly works.

#7 ChunLing

  • Members
  • 2,027 posts

Posted 14 January 2013 - 12:56 PM

put a print to print out what you're using in shell.run()

#8 RunasSudo-AWOLindefinitely

  • Signature Abuser
  • 249 posts
  • Location/dev/earth1aus5

Posted 14 January 2013 - 01:01 PM

Try these (in separate programs)

Firstly, try
shell.run("go up 1")

If that works, then try
rednet.open(  SIDE  )
id, message = rednet.receive()
print(message)
shell.run(message)

If that works, then your program is doing something weird.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users