question

Mohamed Slama avatar image
0 Likes"
Mohamed Slama asked Mohamed Slama edited

Stop Item on onmessage trigger

Hi,

In my simulation I want that if the photoeye 2 is blocked, it should send a message to photo eye 1. Then the photo eye1 should stop the item at the photoeye 1 position when it receives the message. Please can you help to resolve this problem ?

un-deux.fsm

,

Choose One
photoeyestop itemon message trigger
un-deux.fsm (21.4 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Sam Stubbs avatar image
1 Like"
Sam Stubbs answered Mohamed Slama edited

I see that you had your Photoeye 2 send a message to Photoeye 1 on the OnBlock trigger. I merely added a first parameter (a "1") to the message.

So the next step was to create a snippet of code in the OnMessage trigger of Photo Eye 1. The code is simply one line that sets a label (called "stopitem") to current (Photoeye 1) with the value of that message parameter we added (1).

  1. setlabel(current,"stopitem",msgparam(1));

Finally, we add a trigger to the OnBlock trigger of Photoeye 1, that checks if it has a "stopitem" label with a value of 1 (true) on itself, if so, then stop the item.

Here is you example with those changes I made.

5922-un-deux-1.fsm


5922-un-deux-1.fsm (18.6 KiB)
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Steven Hamoen avatar image
1 Like"
Steven Hamoen answered Steven Hamoen edited

@Mohamed Slama Because the photocell or decision points do not have an onmessage trigger you should solve this differently. If you put a label on PE1 and set that label in PE2 to for instance 1, you can use the option Stop Item with the condition that the label should be 1

@Mohamed Slama @Sam Stubbs Sorry I totally overlooked the On Message trigger at the bottom!! But the concept still stands ;-)

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.