Code will not run!

We can successfully download our vex IQ code blocks program onto the brain, however when we run the code it only runs 1 second of the first command, and then it stops.

Welcome to the forums!

Can you post a screenshot of your code? That will help a lot in being able to help figure out what’s going on.


I can not at this time post a screenshot, however, I can tell you the blocks we have:

When started
play sound: Siren 5x

Unless you have the code in a forever block, it will only run once through, as it has no other instructions telling it to keep doing that.

We don’t want it to run “forever” we just want it to play the siren 5 times. however right now it is only playing half a time!

Sound playback is asynchronous (ie. it happens at the same time as other lines of code) so you need a delay before asking the brain to play two sounds back to back otherwise the second “play sound” will stop the first.



@Bob_Mimlitch_III this appears to be a key concept that might benefit from a KB article about synchronous vs asynchronous functions (yikes not volunteering to write one - but maybe there are others ready to author one or do a video tutorial).

@jpearman @tfriez is there a current way to wait for sound to complete before moving onto next step in program? Conceptually, it might be good to have this for playing sounds, much like motor functions…


We actually are trying to run a mother and the sound was just an example.
By the way, we have checked the ports.
Is it possible that there is some setting on the brain/code that is preventing the code from working?

Unfortunately not for either IQ generation 1 or generation 2 (reasons why are complicated to explain). We have that capability on EXP but only when using C++ or Python.


Is this what your code looks like
Code help in Forum
If so then I think that you should check the firmware for an update. if that doesn’t work put a wait 1 second block above the siren and take out the repetition. See what happens then.

that is what it looks like.

What do you mean by a firmware update?

whenever you have the brain connected to your computer and you are going to hit the download button. it should be directly to the left of that.

1 Like

I explained the issue with sound playback yesterday, look at earlier posts in this topic.

I assume you mean motor.

post the exact code you are trying to run and then we can help you. Don’t get distracted by suggestions of needing a firmware update.

Are you using a generation 1 or generation 2 (color screen) IQ brain ?


i actually found the issue. i did not enter the right port number LOL