Hello everyone!
I'm sarita and I'm trying to use the emit function, in order to have the robots communicating with each other. However, i'm with some problems.. :'(
The robots are not receiving the information emited. I tried to use the example that was provided in the website, but it still doesn't work.
This is the example:
Code for Robot 1
- variables
var counter = 0
onevent ir_sensors
if counter == 10 then
emit move [1,0]
end
if counter == 100 then
emit move [0,1]
end
counter += 1
Code for Robot2:
- events
onevent move
if args[0] == 1 then
leftSpeed = 400
rightSpeed = 400
else
leftSpeed = 0
rightSpeed = 0
end
onevent stop
leftSpeed = 0
rightSpeed = 0
Code for Robot3:
- events
onevent move
if args[1] == 1 then
leftSpeed = 400
rightSpeed = 400
else
leftSpeed = 0
rightSpeed = 0
end
onevent stop
leftSpeed = 0
rightSpeed = 0
Help me please!