So I’m using a fairly simple bit of code to set the face lights to different levels of dimness using a FOREACH_FACE loop. It looks like this:
FOREACH_FACE(f){
setFaceColor(f,dim(WHITE,51*f));
}
When I run it in setup it works perfectly for any color I want. The P0 light is off, the P5 light is full strength, and so on. But later in my code I change the color within an if/else statement, and now I’m getting a different result. Here’s the code:
FOREACH_FACE(f){
if(getLastValueReceivedOnFace(f) == 0 && !isValueReceivedOnFaceExpired(f)){
//you have been commanded to be RED
setFaceColor(f,dim(RED,51*f));
gameState = 3;
} else if (getLastValueReceivedOnFace(f) == 2 && !isValueReceivedOnFaceExpired(f)){
setFaceColor(f,dim(GREEN,51*f));
gameState = 3;
} else if (getLastValueReceivedOnFace(f) == 4 && !isValueReceivedOnFaceExpired(f)){
setFaceColor(f,dim(BLUE,51*f));
gameState = 3;
}
}
This results in the brightest face turning the requested color, but the other 5 stay white (I can’t say if the off face has changed, but still). It seems like the loop is being interrupted, and only one value is changing while the others stay the same?