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. See Also


 void setTaskVar(int id, void * var) 


id : Task identifier of the task to modify
var : New value to set for the task variable


This function sets the value of the user variable for the task. The task user variable is maintained by the task manager but is not used by the task manager. It can be used for any desired purpose. In many cases, it is useful for a task function to be designed to operate as a ‘state machine’. In this case, the task user variable can be used to maintain the current state code for the task. In other cases, the task variable can be used as a parameter to the task function. It can, for example, hold a pointer to a data structure used by the task. The task variable is set to 0 when the task is created.

Return Value


Conforming To

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

See Also

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