user4966: I'm working on a project and I need to print serial to a LCD but only if the first letter of the serial is ":"
I have the serial being stored in a char and a if statement reading the first letter of the char to see if it is ":" From there I can't get it to print to the LCD without the first letter. I also don't know how to clear the char.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

char inData[20];
char inChar;
byte index = 0;

void setup(){
 lcd.begin(16, 2);
 Serial.begin(9600);
}

void loop()
{
  while(Serial.available() > 0) 
  {
      if(index < 19)
      {
      inChar = Serial.read();
      inData[index] = inChar;
      index++;
      inData[index] = '\0';
  }
 if(inData[0] == ':') {
   lcd.print(inData);
   }

  }
 }


user368: Tell it to print starting from the second character.
lcd.print(inData + 1);


4966: <p>I'm working on a project and I need to print serial to a LCD but only if the first letter of the serial is ":"</p>

<p>I have the serial being stored in a char and a if statement reading the first letter of the char to see if it is ":" From there I can't get it to print to the LCD without the first letter. I also don't know how to clear the char.</p>

<pre><code>#include &lt;LiquidCrystal.h&gt;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

char inData[20];
char inChar;
byte index = 0;

void setup(){
 lcd.begin(16, 2);
 Serial.begin(9600);
}

void loop()
{
  while(Serial.available() &gt; 0) 
  {
      if(index &lt; 19)
      {
      inChar = Serial.read();
      inData[index] = inChar;
      index++;
      inData[index] = '\0';
  }
 if(inData[0] == ':') {
   lcd.print(inData);
   }

  }
 }
</code></pre>
 368: <p>Tell it to print starting from the second character.</p>

<pre><code>lcd.print(inData + 1);
</code></pre>
