How to pass variables to custom callback functions
The function you are trying to call is a template function:

template&lt;typename TArg&gt;
void attach_ms(uint32_t milliseconds, void (*callback)(TArg), TArg arg)
{
    ....
}


So, you need to tell it what type of parameter you are passing:

change_pin.attach_ms&lt;uint8_t&gt;(100, [](uint8_t state_to_change_to) {
//                     ^- tell the compiler about the parameter
    ....
}, desired_state);




To pass more than one parameter: Since the library only allows one parameter, I would create a struct and pass a pointer to it.

struct callback_parameter {
    int i;
    char *p;
};


Then create one of these structs and pass the address of it. You just have to make sure the struct is valid the entire time the timer is running. So either use new, static, or make it global.

callback_parameter param; // global variable

...

change_pin.attach_ms&lt;callback_parameter *&gt;(100, [](callback_parameter * state_to_change_to) {
    ....
}, &amp;param);