Page 1 of 1
script communication
Posted: 11 Feb 2020, 12:29
by sampits
Ive been working with two script one move a conveyer depending on the proximity sensor state and for that i used the sysCall_sensing() function.
Now i want to go there with my robot but i can seem to be able to communicate between the scripts since the sensordetection variable doesnt work outside of the function sysCall_sensing or so i think.
Any ideas on how i can call that function on the robot script?
Re: script communication
Posted: 11 Feb 2020, 15:02
by coppelia
Re: script communication
Posted: 11 Feb 2020, 15:56
by sampits
now i have a different problem, when i pass a 0 to the conveyer it runs and when i pass a 1 it stops, even tough it works, when i am in 0 it doesnt change to 1 and when i am in 1 it doesnt change to 0 its weird to explain but what im trying to say is that once it is in a a state it doesnt change to other.(doesnt update the state)
Code: Select all
teste=sim.getFloatSignal("ok")
if teste==0 then
beltVelocity=sim.setFloatSignal("conveyorBeltVelocity",0.05)
else
if teste==1 then
beltVelocity=sim.setFloatSignal("conveyorBeltVelocity",0)
end
end
Re: script communication
Posted: 11 Feb 2020, 17:01
by sampits
now i have a different problem, when i pass a 0 to the conveyer it runs and when i pass a 1 it stops, even tough it works, when i am in 0 it doesnt change to 1 and when i am in 1 it doesnt change to 0 its weird to explain but what im trying to say is that once it is in a a state it doesnt change to other.(doesnt update the state)
Code: Select all
teste=sim.getFloatSignal("ok")
if teste==0 then
beltVelocity=sim.setFloatSignal("conveyorBeltVelocity",0.05)
else
if teste==1 then
beltVelocity=sim.setFloatSignal("conveyorBeltVelocity",0)
end
end