Sending array values over serial?

             if (totalvals == 1){
              bankval1 = nnn;
              nnn = 0;
            }
            if (totalvals == 2){
              bankval2 = nnn;
              nnn = 0;
            }

If totalvals is 1, can it also be 2? If not, then a switch statement is more appropriate.
Setting nnn to 0 in each block is not needed. Set it once at the end.

I thought you were trying to store the values in an array.

Yes, the values will be going into an array. However, how they will get there is thru eeprom.

The idea of this method is so I don't have to give away all my source code, but still allow people to program parameters in the code.

So basically, these values will be sent over serial, and written to eeprom. Then, when the uC is restarted, all the values are read from the eeprom into the array during the setup.

So, in the switch, I'll end up putting something like:

 switch(c)
   {
	case 'a':
         EEPROM.write(1,bankval1);
         EEPROM.write(2,bankval2);
          break;
}

For example.

Then in setup, they can be read into the array like:

byte array[3][10]{
 {EEPROM.read(1), EEPROM.read(2), EEPROM.read(3) ....};,

I am assuming that will work? Please correct me if I am wrong :slight_smile:

Cheers,
Dan

So, in the switch, I'll end up putting something like:

I'd put something like:

 switch(c)
   {
	case 'a':
          for(byte b=0; b<10; b++)
          {
            EEPROM.write(baseAddr+b,array[b]);
          }
          break;
}

after having collected all the values into an array (which uses a lot less code). After all, that was the purpose of introducing totalvals - so that you could use it as an array index.

Hmm OK, that seems much cleaner :slight_smile:

Cheers,
Dan