Beginner: Executing a command in a new COG
Chad1
Posts: 26
in Propeller 1
Hi everyone,
Here's what I want to do: Blink an LED on and off WHILE a sound plays (code is in SPIN). Or, simply continue executing my main program WHILE a sound plays.
I'm using the WAV-Player_DACEngine.spin object file to play the audio. When I execute the statement to play the audio (dac.playWAVFile(string("sample.wav")) for example), it stops the LED in its present state until the audio is finished playing. Once the audio is done playing, only then does my program continue running.
I'm sure the solution is simple and involves running a new cog. But after reading the Propeller Manual and searching the web for examples, I still don't have a good grasp of how to set it all up (I get confused whenever memory, addresses, and longs become involved). I figure creating a new PUB and executing the COGNEW statement is required. If so, how would you define the COGNEW and PUB statements based on my application? Can someone help me figure this out?
Thanks!
Here's what I want to do: Blink an LED on and off WHILE a sound plays (code is in SPIN). Or, simply continue executing my main program WHILE a sound plays.
I'm using the WAV-Player_DACEngine.spin object file to play the audio. When I execute the statement to play the audio (dac.playWAVFile(string("sample.wav")) for example), it stops the LED in its present state until the audio is finished playing. Once the audio is done playing, only then does my program continue running.
I'm sure the solution is simple and involves running a new cog. But after reading the Propeller Manual and searching the web for examples, I still don't have a good grasp of how to set it all up (I get confused whenever memory, addresses, and longs become involved). I figure creating a new PUB and executing the COGNEW statement is required. If so, how would you define the COGNEW and PUB statements based on my application? Can someone help me figure this out?
Thanks!
Comments
where Blink and PlayWav are the PUB methods that contain the code to start their tasks...
Edit: Fxied BBCode..