i just want to know why when i use serial.read to take multiple inputs does not work
for example,
if (Serial.available() > 0) {
if ( Serial.read() == 110) // n in ASCII
{
}
if (Serial.read() == 104) // h in ASCII
{
}
if (Serial.read() == 108) // l in ASCII
{
}
}
in this code i need first to insert n, then hh, and then lll to make it work
Code snippets aren't nearly as helpful as the entire sketch. Also, in your code, you're going out of your way to make it hard to read by using the ASCII numbers. Also, what if the character comes in as 'N' rather than 'n'? Finally, if you do get an 'n' you still perform checks to see if it's something else...not good. What about:
while(Serial.available() > 0)
{
c = tolower(Serial.read()); // Make sure it's lower case
switch (c) {
case 'n':
// whatever...
break;
case 'h':
// whatever...
break;
case 'l':
// whatever...
break;
default:
Serial.print("I shouldn't be here. c = ");
Serial.println(c);
break;
}
}