A while back, I had asked for Webbot's help on how to store numbers typed in HyperTerminal and send the collected data to an MP3Trigger. Some of the "plain English" code was as follows:
if( got a byte from the uart ){
read the byte
if it is '0'..'9' then
uint8_t val = char - '0'; // Change from ascii to a number
trackNum = trackNum *10 + val; // Keep the 'total' in trackNum
...
It works great and the code is still in use, but I was wondering if there was a "saving characters" equivalent or if there was someway of accomplishing the following.
__?__ varX; // not sure what type to declare (see below)
__?__ varY;
char mapPoints[2][4][2]={{"A1","A2","A3","A4"},{"B1","B2","B3","B4"}}; // maybe not the most proper but
technically valid from what I have read. I know this is not so much an "array of strings" as it is an "array of characters".
for (x=0; x<=3; x++) // the A array elements
{
// assign 'A#' to varX;
// do stuff
for (y=0; y<=3; y++) // the B array elements
{
// assign 'B#' to varY;
// do stuff
if (condition)
{
// do something
]
}
next B
}
next A
The problem I am having is assigning multi-character values to varX and varY. Using "wchar_t" does not seem to work like I was led to believe it should. Various joining methods (strcat, append, superGlue) do not seem to work. Any ideas?