TeensyThreads, threads.addThread() , how to send multiple args to the function ?

xatifx

New member
Hi all,
Im not an expert but you guys help me keep moving.. Here is my question,

I am using the TeensyThreads.h and i know how to call functions that have no arguments with thread.addthread... but now..

I want to call a function that takes two parameters, name and speed.
void Edge1(char *sketchName, float BPM)

I am calling it in threads.addThread(Edge1) which works when there are no parameters.

How do i do something like this:
threads.addThread(Edge1("Cylon", 120.5))

I am not getting the syntax right. Is it even possible ?

Thankyou !
 
Thank you for responding but that did not work !

Severity Code Description Project File Line Suppression State
Error (active) E0304 no instance of overloaded function "Threads::addThread" matches the argument list
Teensy 3.6 Exp C:\Users\.......\Teensy 3.6 Exp.ino 187
 
Indeed.
I read the doc too fast: addThread() only accepts functions with a single argument of type either int or void* so I guess you must do it the old way and pass the address of a struct containing your arguments / callback object...
 
Back
Top