Activity bot - how to program to drive and play freqout() at same time?
dsomashe
Posts: 21
Hello, I just got an activity bot and have gone through the tutorials as best as I can. However, I am unable to figure out how to have the robot drive in a set pattern (and repeat that pattern) with drive_goto (), while simultaneously playing a little song I made using the freqout () function. Since it is reading the code line by line, it will either play the music and THEN drive, or drive and THEN play the music. Is it possible to get it to loop the music and then do the drive function independent of that?
I screwed around with the while() function but again, it will only do one or the other, not both simultaneously.
Sorry, a beginner's question I know. Thank you so much for any help.
I screwed around with the while() function but again, it will only do one or the other, not both simultaneously.
Sorry, a beginner's question I know. Thank you so much for any help.
Comments
There are tutorials on using multi cores in functions in 2 areas of the Learn section of the parallax web site.
The first link below shows one method (using older functions). The second link is the way that parallax currently recommends. Essentially, you define a function that plays the music, and in the main program start a new cog that runs that function (call the the drive function in main without you starting a new core after you start the music function.
Give it a try and let us know how things work. If you have problems, I'm sure forum members can help.
Tom
http://learn.parallax.com/propeller-c-functions/multicore-example
http://learn.parallax.com/multicore-approaches