BlueTooth Message Received Bit?

Discussion specific to projects ideas and support.
Post Reply
cpapple123
Posts: 44
Joined: 04 May 2012, 20:20

BlueTooth Message Received Bit?

Post by cpapple123 »

When does the Message Received bit turn off? What I’m hoping is this bit is set when New data is loaded into the mail box and turned off when the receive message block is scanned. I want to use this bit to make sure that the message is new before continuing the program. Also I see two ways of doing this.

1 Receive Message Block in a Logic Loop. Then use the Message received and Yes/No to make the determination it is ok to continue.

2 Wait Block set to Sensor/Receive Message then Compare the value. With this there is no Message Received flag so how can I be sure the data in the Mailbox is new.

Here is what in the end I’m trying to achieve. I have two crane bots. Cranebot1 will pic a ball from a stand and place it on a new stand then get out of the way. It can only do this if CraneBot2 says it out of the way. CraneBot2 will sit motionless until Cranebot1 say the ball is placed and is clear. Then CraneBot2 will pic the ball and place it on a new stand. Then when CraneBot2 is done repeat the sequence. I want to be sure that the clear and start signals are not old data from the last cycle. I was just wondering if I need to develop my only message handshake clearing the data after reading it or of if this is built in somehow.

CrainBot1 will be the master. So I believe the Message blocks will be configured as Connection “1”, Message “Logic”, Set “True”, Mail Box “1” (when its Clear)
Connection “1”, Message “Logic”, Set “True”, Mail Box “2” (when its Done)

CrainBot1 will watch
Mailbox 1 for “True” (to know Crainbot2 is Clear)
Mailbox 2 for “True” (to know Crainbot2 is Done)



CrainBot2 (slave) will watch
Mailbox 1 for “True” (to know Crainbot1 is Clear)
Mailbox 2 for “True” (to know Crainbot1 is Done)


CrainBot2 will also have a send message block with the setting
Connection “0”, Message “Logic”, Set “True”, Mail Box “1” (when its Clear)
Connection “0”, Message “Logic”, Set “True”, Mail Box “2” (when its Done)
*Choosing "0" will send messages from slave NXT to master NXT.

Real Simple or will I need to create Messages to “False” the Mailbox messages?

These sample programs have both Robots logic in one program to easily compare the two side by side. In real life these would be two separate programs in two different robots.

BT Cranebot V1 was a sample I wrote but I quickly noticed that if my theory that the Message received bit is true for one read cycle then I would miss it if all Read blocks did not see true the same cycle as the NXT button

BT Cranebot V2 has Memories to catch the True condition and reset the memories after a cycle starts
Attachments
BT CraneBot V2.rbtx
(515.99 KiB) Downloaded 513 times
BT CraneBot V1.rbtx
(291.07 KiB) Downloaded 316 times
cpapple123
Posts: 44
Joined: 04 May 2012, 20:20

Re: BlueTooth Message Received Bit?

Post by cpapple123 »

Great News my V2 worked in concept only a few overlooked bugs. If anyone wishes to see what did work take a look.
Attachments
bt5.rbt
Must start this robot first later code will have to be less dependent on that
(1.68 MiB) Downloaded 322 times
bt4.rbt
(1.56 MiB) Downloaded 313 times
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests