chipKIT® Development Platform

Inspired by Arduino™

Last edit: 2021-03-21 22:34 by Majenko


  1. Synopsis

  2. Parameter

  3. Description

  4. Return Value

  5. Conforming To

  6. Example

  7. See Also


 int getTaskId(taskFunc task) 


task : Pointer to the task function


This function returns the task identifier of the task associated with the specified task function. It returns -1 if no such task is defined. If multiple tasks are using the same task function, it returns the first one found.

Return Value

If the specified task exists, the task id is returned. If the task can’t be found, the value -1 is returned.

Conforming To

The Task Management Functions are specific to ChipKit and exceed the Arduino 1.6.x specification.


 int blink_id;
 int test_id;
 unsigned long blink_var;
 void blink_task(int id, void * tptr) {
   digitalWrite(led, !digitalRead(led); // Toggle pin state
 void setup() {
   pinMode(led, OUTPUT);
   blink_id = createTask(blink_task, 200, TASK_ENABLE, &blink_var);
   test_id = getTaskId( blink_task);

See Also

createTask(), destroyTask(), getTaskId(), getTaskNextExec(), getTaskPeriod(), getTaskState(), getTaskVar(), setTaskPeriod(), setTaskState(), setTaskVar(), startTaskAt(),