Code works with Green Flag but not broadcast

This is the place to ask question about Enchanting, talk about your Enchanting projects or simply find out more about Enchanting on the NXT.

Moderator: clintonb

traisen
New User
Posts: 23
Joined: Mon Dec 15, 2008 6:53 am

Code works with Green Flag but not broadcast

Postby traisen » Mon Jun 24, 2013 1:58 pm

Hi,
I wanted to use this program to introduce broadcast. Will mostly use with sensors.

(works) First put the code for each motor under a start when green flag clicked
Works: both motors run when green flag clicked.
Changed so
(doesn't work) Broadcast Start when green flag clicked
Put code to run motors under 2 different When I receive Start control block; But only 1 motor runs; However if add turn Light LED on in block where the motor never starts, the LED comes on.

Is this a motor specific broadcast problem? I added Set Light Sensor to Red and light comes on but the motor doesn't although that code comes first.
Is there a list of problems /things I need to have the kids avoid using next week?

Works:
Image
With Broadcast doesn't work:
Image

clintonb
Active User
Posts: 138
Joined: Fri May 28, 2010 1:44 am
Location: Cardston, Alberta, Canada
Contact:

Re: Code works with Green Flag but not broadcast

Postby clintonb » Mon Jun 24, 2013 2:40 pm

It is a timing problem.

The 'start' message is broadcast before the other threads are even waiting to receive it.

The workaround for right now is to put a delay before your broadcast. 'wait 1 sec' should do it.

Cheers,
Clinton

traisen
New User
Posts: 23
Joined: Mon Dec 15, 2008 6:53 am

Re: Code works with Green Flag but not broadcast

Postby traisen » Mon Jun 24, 2013 8:38 pm

Thanks


Return to “Enchanting Questions and Projects”

Who is online

Users browsing this forum: No registered users and 3 guests