We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have been trying to find a way to create a thread out of methods from an object. I understand how to extend the Thread class and use that, but it would be much more effective if I were to use thread(). The issue is that when I try to call a method that's in an object, I get an error message. For example:
Thing trevor = new Thing(71);
void setup() {
thread("trevor.printNum");
}
class Thing {
int num1;
Thing(int n1) {
num1 = n1;
}
void printNum() {
println(num1);
}
}
This produces the following message: There is no public trevor.printNum() method in the class sketch_131029c
What do I need to do in order to get thread() to work in this situation? Thanks.
Answers
Both thread("") & method("") can only invoke functions belonging to the main sketch; not from other classes! :(
And neither pass nor return arguments! 8-|