Multi Taking
Robert Hodgen
Posts: 8
How can I get the BOE-Bot to multi task, I need it to play audio (using the command FREQOUT) and navigate (with IR) at the same time.
Thanks,
Robert
Thanks,
Robert
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
BTW, I am pushing hard in the SX forum for example code to do these kinds of things, ie - play audio, IR remote control, IR/detect, .... , etc. Hope this helped.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
http://www.bluebelldesign.com/FSM_explain.htm
Bruce
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Name: Bruce Clemens
Work:· Clemensb@otc.edu
Good Stuff on my Blog: http://theDeadBug.journalspace.com
However, you still can't play music AND run a motor at the same time -- just interleaved very rapidly.
Post Edited (allanlane5) : 3/30/2005 9:38:29 PM GMT
Can you also give me a little more information about your task manager?
Robert
It lets you implement a finite state machine -- each time through the loop, the CurTask variable causes a GOSUB to a different sub-task subroutine. You'd have to time it to see what the cycle time is -- I assume it's around a milli-second, though.
The general idea for me was that I wanted the robot to start from a remote control -
Main:
·DO
·· GOSUB GetRemCode 'Asubroutine that checks for a button push
· IF (remoteCode > 0) then ProcessCode
·LOOP
ProcessCode:
IF(remoteCode = 21) then StopMov 'Red button STOP, robot stops
IF(remoteCode = 11) then Xauto 'This starts the AUTO mode, free roaming
return
Within the processCode I would add all of the buttons that I wanted to use. Next came the actual loop, this is where it would check for the different states·-
Xauto:
GOSUB GoFore 'Starts the dc motors, free roaming
Aloop:
·IR_outputs =0
GOSUB CheckRem 'subroutine that checks to if remote control button was pushed
'In here I had the code for the firing of the IRLED for the detector and detector code to respond to either IRLED or remote IRLED. I guess within this loop you could place all of the things that you would want done. The 'pseudo multitasking'.
goto Aloop
All of my subroutines were after this point.
Basically this was the format that I tried to stick to. But you have to be very carefull with the use of your subroutines, and/or ending up with 'spaghetti code'. I always try to stick with the 'KISS' principal. If you need anything more specific, then feel free to ask, just try to keep the question as suscinct as possiple, that is·so I do not try to second guess you, and end up wasting everybodies time.