Hello. I have an array of 3 values (10, 11, 12), that when I press a momentary button advances to (13, 14, 15) advancing each number by 3 with every button press. I would like the limit of my up counter to be (16, 17, 18), then, if momentary button is pressed again, it returns to (10, 11, 12). The values should always be sequential like (10, 11, 12), so it should never be (10, 13, 16) or out of sequence numbers like that, which is happening with my bad code.
If this is confusing, then it's my error for being unclear. It's intended to be a simple 'preset' system on a synth. Each of the three values inside the parentheses represents an EEPROM address to be read, sending the byte value stored in the addresses to 3 potentiometers. Going out on a limb, I want to say that most synths have a preset system that works like this.
I'm having a lot of trouble returning to the original value, and suggestions I've gotten don't seem to work. Here is the relevant section of code, but if it's hard to tell from what's there, I will gladly post the whole code. What should I do differently?
This is from the section of the code where the button is pressed
This is at the end of the code, where someone suggested I place it. The numbers go all out of order, and even exceed 15 sometimes.
Thanks!
If this is confusing, then it's my error for being unclear. It's intended to be a simple 'preset' system on a synth. Each of the three values inside the parentheses represents an EEPROM address to be read, sending the byte value stored in the addresses to 3 potentiometers. Going out on a limb, I want to say that most synths have a preset system that works like this.
I'm having a lot of trouble returning to the original value, and suggestions I've gotten don't seem to work. Here is the relevant section of code, but if it's hard to tell from what's there, I will gladly post the whole code. What should I do differently?
This is from the section of the code where the button is pressed
Code:
addr[i] = addr[i]+3;
This is at the end of the code, where someone suggested I place it. The numbers go all out of order, and even exceed 15 sometimes.
Code:
for (byte i = 0; i < 3; i++){
if (addr[i] > 15){
addr[i] = 10 + i;
}
}
Thanks!