Good, I summarize my problem: I have a series of conditions and each time one of them is fulfilled I would like a led to light up and an accountant to increase, that is, having 4 conditions, there would have to be 4 counters. I show it in an image what I have done together with the code in java so they can understand me.
Java code:
for (i = 0; i <10; i ++)
if (x <0.25) {
Turn on a led1;
r1 = r1 + 1;
} else if (x> = 0.25 & <= 0.5) {
Turn on a led2;
r2 = r2 + 1;
} else if (x> 0.5 & x <= 0.75) {
I turn on a led3;
r3 = r3 + 1;
} else {
I turn on a led4;
r4 = r4 + 1;
}
}
I have made the conditions and the for loop, but I do not know how to pass a counter to each condition so that each time one of the ifs is fulfilled, the respective led lights up and the counter accumulates.
I hope you can help me !!