Indeed, i made a mistake in the arduino code. Although it‘s similar to processing there are some differences in the syntax
.
I fixed it, and now it should work.
As for where to put the variable? What do you mean by that? Which variable?
You should listen to the Serial Input and set your intVals[] to the resulting values in draw. You could also use a Serial Event, but that‘s not really neccessary in your case i think…
And then, just use the intVals[] to set maybe the position of individual fingerparts or something like that… as for how to do that, you‘d want to create a new Global method and call it in draw(), to keep it clean (not having 300+ lines in draw…).
And within that method, you just do something like this :
for (int i = 0; i < serialInArray.length; i++) {
hand.getFinger(floor(i/3)).getFingerPart(i%3).setAngle(serialInArray[i]);
}
//this would loop through multiple fingers with each having 3 Finger parts
//and set their angle to be the corresponding intVals value.
//in your case though it‘s better to just get and set them manually, not in a for loop (cause you only have 3 Inputs for now, so not worth it)
//you could also use (floor(i/5)) to get to the next Hand when one is done, because 5 fingers per Hand...
//though you‘d have to start with body.getHand(floor(i/5)).getF...
//or in your case the Code would be ~ this
for (int i = 0; i < serialInArray.length; i++) {
hand.moveFingers(i, serialInArray[i]);
}
//though i didn‘t check if these methods really work Right, if they do what they look like they’re supposed to do, then this is how it should go well.
}