unofficial answer: speaker sound and movement

this is an answer to this thread on which I am not allowed to reply. It’s hard to tell for sure what wrong but I’m going to make a guess that your code is similar to the psoduecode that follows:


//robotc main task
task main()
{
   //play the music
   PlayMusic();

   //infinite loop for user control
   while(true)
   {
      SomeUserControlCode();
      //don't hog cpu!
      wait1Msec(25);
   }
}

if this is how it’s set up the the issue is that in the code it looks at PlayMusic, now it can’t do anything but play music until it get’s to while(true), that’s when the user control code starts. If you want the music to play at the same time is the usercontrol is running, you should use a task. tasks are like functions that run at the same time as other tasks (well not completely true because it works on interrupts but whatever) .
the code as follows.



task music()
{
  //we want the music to play again when it's over.
  while(true)
  {
    //play the song.  It would make more sense
    // to put the contents of this function in this task
    //and just get rid of the function but this is just an example
    PlayMusic();
   }
//robotc main task
task main()
{
   //the music will start playing but it will still continue to
   //the user control
   starkTask(music);
   //infinite loop for user control
   while(true)
   {
      SomeUserControlCode();
      //don't hog cpu!
      wait1Msec(25);
   }
}