Hi,
I'm working on a data field and trying to use playTone each time I reach a certain front/rear derailleur number.
I have a isRinging var that is supposed to forbid the loop.
I don't understand why but it keeps ringing in loop each time I reach that derailleur combination.
Here is the code in compute:
if (info.frontDerailleurIndex == 2 && info.rearDerailleurIndex == 4 && isRinging == false) {
var toneProfile = [new Attention.ToneProfile(300, 250)];
Attention.playTone({:toneProfile=>toneProfile, :repeatCount=>1});
isRinging = true;
} else if (info.frontDerailleurIndex == 1 && info.rearDerailleurIndex == 7 && isRinging == false) {
var toneProfile = [new Attention.ToneProfile(3000, 250)];
Attention.playTone({:toneProfile=>toneProfile, :repeatCount=>1});
isRinging = true;
} else if (isRinging == true) {
isRinging = false;
}
My var is declared at the beginning of my data field class
I'm a complete beginner in Monkey C and don't understand the issue.
Do you have an idea ?