I have an int array holding 160 single digit values that are either 1, 2 or 0. In fact there are three of these arrays -all the same. I've been having what I thought were overflow problems so I made a smaller program and sent the values to the serial port with a loop.
I only write to a few of the locations in the array using firstArray[position] = 1; where position is always between 0 and 159.
So there is no fear of overflowing the array.
When I get the serial print out, the second array comes back as expected: 160 values that are perfect. But the first and third arrays come back intact only to about 148 positions and then i get an additional strand of nonsense numbers, including multiple negative signs that extend way out past the 160 values.
I have tried putting delays in the serial print loop thinking that the port was drinking from a fire-hose, but no dice.
I don't think it's a serial.print issue or a serial port buffer size because this is exactly the problem my larger program was symptomatic of.
Any thoughts?