I have a problem where I am adding to an array at the next point. I decided to do this:
X_all[X_all.length]=X_current;
is there a workaround for this, or is there a .push function? arduino doesn't seem to have very good documentation on arrays, and I can't find a way to do this without using a variable to count the array entries. any ideas?
Arduino has only fixed length C style arrays. No .length, no adding on to the end. C++ would have assorted container in its standard template library, but you would have to add it manually , and find one that behaves well in spite of the tiny memory.
In C++ that would typically look like:X_all[count++]=X_current;
. You have to set the size of X_all when you create it and make sure 'count' never reaches that size.
oztechlab:
arduino doesn't seem to have very good documentation on arrays
"Arduino" arrays come from from the C++ programming language, they are not a feature of the arduino programming environment, specifically. Google "C++ tutorial" to learn about them.