Menu

tieInput

Majenko Technologies

Format

:::C
void tieInput(int in, void (*func)(int, int));

Description

Connects an input to a callback function. When the input changes the callback function gets called. The function is passed the number of the input channel that changed, and the current value of that input channel. Only works for digital inputs.

Example

:::C
void button_pressed(int in, int value)
{
    if (value == 0) {
        queueSample(hey_man, hey_man_len, 0, 0)
    }
}

void main()
{
    setInput(3);
    tieInput(3, button_pressed);
}

Related

Wiki: Firmware Functions

MongoDB Logo MongoDB