Multitasking is going to be crucial to building a robust robot. Make sure you know how to use these commands with at least some ease.
It is often said that one of the best ways to learn code is to read through examples and to play with them. See the sample code section for examples on how to use tasks and events. Download some samples and experiment with them, making sure you understand how everything works.
code_start
argc
and argv
are used for passing parameters to the
function code_start
, but you most likely will not need them, so just
leave them both as 0 for now.
Parameters: |
code_start
-
a function pointer for where the thread should begin execution
priority the priority of the new thread. Should be in between PRIO_LOWEST and
PRIO_HIGHEST . Typically, set this value to PRIO_NORMAL
plus or minus one or two.
stack_size unless you are an elite h4X0r, leave this as DEFAULT_STACK_SIZE
|
code
. This will also
free any memory allocated by the task.
pid
as assigned when it was started
by execi()
prio
wakeup
returns a non-null value. This is confusing if you are not familiar with
function pointers, so see the
example on how to use it.
#include <sys/time.h>