I wrote a program using PROGMEM for massive string arrays. One of the arrays worked, but when I added the second one, the serial output only puts out "th".
Pastebin Code: http://pastebin.com/9U7QZQKn
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up.Sign up to join this community
Your declaration of char buffers is done like so:
char* move1 = "N/A";
This will only allocate 3 characters with an additional one for null termination i.e. not long enough to hold the name.
You need to do:
Where the length is long enough to hold your string.
I see one major flaw in your code, related to index usage on arrays.
Arrays in C and C++ are using a 0-based index, meaning that, for an array containing
However, your code uses
TrueRandom.random(1,numPokemon+1); which means you'll get an index between
numPokemon (included), if you get the
numPokemon value for your index, then you'll get garbage as it will try access some other part of memory.
Maybe that is not the only problem in your code, but this one is a major bug.