Arduino Serial.read help

So I am brand new to Arduino, and a complete novice, so please excuse me if this is a really dumb question

I wrote this code:

int incomingByte = 0;

void setup() {
Serial.begin(9600);

}

void loop() {

if (Serial.available() > 0) {

incomingByte = Serial.read();
}
if( incomingByte == 'h'){

Serial.println("test line");
delay(1000);
}
}

and what I am wondering is this, can I make the incomingByte equal to a full word? I tried 'test' which yielded no results. Do i need to play around with the DEC for each letter? I would much appreciate any help of the matter from you learned arduino folk

can I make the incomingByte equal to a full word?

Not unless the word is "a" or "I", no.

Have you looked at the examples in the IDE?

thanks for the quick reply,

is there any other way to go about this that would allow you to enter in more than one digit inputs?

I have skimmed through some of the IDE examples

As a starting point, try:

char buff[21];
int charsRead;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (Serial.available() > 0) {
    charsRead = Serial.readBytesUntil('\n', buff, 20);
    buff[charsRead] = '\0';
    Serial.println(buff);
  }
}

and figure out what each section of code does. You should be able to modify it to suit your needs.

thanks I will give it a try

You may find some useful stuff in the demos here and here

The Arduino code in the second demo will also work with the Serial Monitor.

...R

nd what I am wondering is this, can I make the incomingByte equal to a full word?

If your "word" is a multi character string, then you can capture the character string sent into a String, then evaluate the captured String for what it contains. Very simple example below.

// zoomkat 8-6-10 serial I/O string test
// type a string in serial monitor. then send or enter
// for IDE 0019 and later

int ledPin = 13;
String readString;

void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT); 
  Serial.println("serial on/off test 0021"); // so I can keep track
}

void loop() {

  while (Serial.available()) {
    delay(3);  
    char c = Serial.read();
    readString += c; 
  }

  if (readString.length() >0) {
    Serial.println(readString);

    if (readString == "on")     
    {
      digitalWrite(ledPin, HIGH);
    }
    if (readString == "off")
    {
      digitalWrite(ledPin, LOW);
    }

    readString="";
  } 
}