Q:

if (indata[0] == '10') does not work

I have been working on some arduino code for a few days and I have ran into this problem. I need to check if inData is equal to a number up to 150 but when I get in the double and triple digits it stops working. Here is the code I am using. it takes number inputs from a keypad that is setup to send its numbers to the arduino's serial RX pin.
Too long to put it here so i put it on pastebin here.
char inData[20]; // Allocate some space for the string
if (inData[0] == '10') {
// Code snipped for brevity
}

A:

I see a couple of issues.
First, use the if..then..else construct or a switch for the several if..then statements.
And, when you do a comparison to a char 10 is two char values so a simple == won't work.
You could convert it to an integer first, using atoi and then do a comparison, or you can look at if (inData[0] == '1' && inData[1] == '0') would do what you want.
UPDATE:
I would ensure that each part of inData is set to zero first, not '0'.
Then use a switch, such as something like this:
switch(inData[0]) {
  case '1':
    switch(inData[1]) {
       case 0:
         // This would be '1'
         break;
       case '0':
         // This will be 10
         break;
    }
    break;
  case '2':
     break;
}

I haven't tested this code, just use as an example.

