Hi @t00cg,
You need to declare to do so ā¦
The Java
volatile
keyword guarantees visibility of changes to variables across threads.
Cheers
ā mnse
volatile int x = 0;
void setup() {
thread("threadcode");
}
void threadcode() {
while (true) {
if (x>20) x=0;
}
}
void draw() {
clear();
x += 1;
text(" "+x, 20, 20);
}
further info:
PS: But I do not recommend to do it the way you implemented it ā¦