How do i set the output with a specific input.

Hello there, im new here. So my problem right now that how do i set the output with a specific input? plus the input is more then one character exmple “<101>”. My plan is, when i type <101> in a serial monitor then the output show “WEST” for example. The program that i only know that what is the input, it will show at the output exact same as the input. Anyone can help me? here is the code

const byte numChars = 32;
char receivedChars[numChars];

boolean newData = false;

void setup() {
	Serial.begin(9600);
	Serial.println("<Arduino is ready>");
}

void loop() {
	recvWithStartEndMarkers();
	showNewData();
}

void recvWithStartEndMarkers() {
	static boolean recvInProgress = false;
	static byte ndx = 0;
	char startMarker = '<';
	char endMarker = '>';
	char rc;
	
	// if (Serial.available() > 0) {
        while (Serial.available() > 0 && newData == false) {
		rc = Serial.read();

		if (recvInProgress == true) {
			if (rc != endMarker) {
				receivedChars[ndx] = rc;
				ndx++;
				if (ndx >= numChars) {
					ndx = numChars - 1;
				}
			}
			else {
				receivedChars[ndx] = '\0'; // terminate the string
				recvInProgress = false;
				ndx = 0;
				newData = true;
			}
		}

		else if (rc == startMarker) {
			recvInProgress = true;
		}
	}
}

void showNewData() {
	if (newData == true) {
		Serial.print("This just in ... ");
		Serial.println(receivedChars);
		newData = false;
	}
}
void showNewData() {
  if (newData == true) {
    Serial.print("This just in ... ");
    Serial.println(receivedChars);
    newData = false;
  }
}

This function displays the string (array of chars) received between start and end markers. The markers are needed in order for the program to know where the incoming data starts and ends. Once the message is in the char array you can test what has been received and act on it, like this

void showNewData() {
  if (newData == true) {
    Serial.print("This just in ... ");
    Serial.println(receivedChars);
    if (strcmp(receivedChars, "101") == 0)
    {
       Serial.println("WEST"); 
    }
    newData = false;
  }
}

Thank you so much OKheliBob. U are so much of helper. here is my complete code modify with the library u8glib.

#include "U8glib.h"
const byte numChars = 32;
char receivedChars[numChars];
boolean newData = false;
char led_pin = 13;
U8GLIB_ST7920_128X64_1X u8g(6, 5, 4 ,7);

void draw1(void) {
 
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  u8g.drawStr( 25, 11, "Emergency");
u8g.drawStr( 33, 23, "vehicle");
u8g.drawStr( 33, 35, "heading");

u8g.setFont(u8g_font_gdr25);
u8g.drawStr(4 , 63, "NORTH");
}

void draw2(void) 
{
 
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  u8g.drawStr( 25, 11, "Emergency");
u8g.drawStr( 33, 23, "vehicle");
u8g.drawStr( 33, 35, "heading");

u8g.setFont(u8g_font_gdr25);
u8g.drawStr( 4 , 63, "N.EAST");
}
void draw3(void) 
{
 
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  u8g.drawStr( 25, 11, "Emergency");
u8g.drawStr( 33, 23, "vehicle");
u8g.drawStr( 33, 35, "heading");

u8g.setFont(u8g_font_gdr25);
u8g.drawStr( 18 , 63, "EAST");
}
void draw4(void)
{
 
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  u8g.drawStr( 25, 11, "Emergency");
u8g.drawStr( 33, 23, "vehicle");
u8g.drawStr( 33, 35, "heading");

u8g.setFont(u8g_font_gdr25);
u8g.drawStr( 8 , 63, "S.EAST");
}
void draw5(void) 
{
 
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  u8g.drawStr( 25, 11, "Emergency");
u8g.drawStr( 33, 23, "vehicle");
u8g.drawStr( 33, 35, "heading");

u8g.setFont(u8g_font_gdr25);
u8g.drawStr( 4 , 63, "SOUTH");
}

void draw6(void)
{
 
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  u8g.drawStr( 25, 11, "Emergency");
u8g.drawStr( 33, 23, "vehicle");
u8g.drawStr( 33, 35, "heading");

u8g.setFont(u8g_font_gdr25);
u8g.drawStr( -1 , 63, "S.WEST");
}

void draw7(void) 
{
 
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  u8g.drawStr( 25, 11, "Emergency");
u8g.drawStr( 33, 23, "vehicle");
u8g.drawStr( 33, 35, "heading");

u8g.setFont(u8g_font_gdr25);
u8g.drawStr( 14 , 63, "WEST");
}

void draw8(void) 
{
 
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  u8g.drawStr( 25, 11, "Emergency");
u8g.drawStr( 33, 23, "vehicle");
u8g.drawStr( 33, 35, "heading");

u8g.setFont(u8g_font_gdr25);
u8g.drawStr( -1 , 63, "N.WEST");
}

void setup(void) {
  Serial.begin(9600);
  Serial.println("<Arduino is ready>");
  pinMode(led_pin, OUTPUT);
  // flip screen, if required
  // u8g.setRot180();
  
  // set SPI backup if required
  //u8g.setHardwareBackup(u8g_backup_avr_spi);

  // assign default color value
  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    u8g.setColorIndex(255);     // white
  }
  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
    u8g.setColorIndex(3);         // max intensity
  }
  else if ( u8g.getMode() == U8G_MODE_BW ) {
    u8g.setColorIndex(1);         // pixel on
  }
  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
    u8g.setHiColorByRGB(255,255,255);
  }
}

void loop(void) {
	recvWithStartEndMarkers();
	showNewData();

}

void recvWithStartEndMarkers() {
	static boolean recvInProgress = false;
	static byte ndx = 0;
	char startMarker = '<';
	char endMarker = '>';
	char rc;
	
	// if (Serial.available() > 0) {
        while (Serial.available() > 0 && newData == false) {
		rc = Serial.read();

		if (recvInProgress == true) {
			if (rc != endMarker) {
				receivedChars[ndx] = rc;
				ndx++;
				if (ndx >= numChars) {
					ndx = numChars - 1;
				}
			}
			else {
				receivedChars[ndx] = '\0'; // terminate the string
				recvInProgress = false;
				ndx = 0;
				newData = true;
			}
		}

		else if (rc == startMarker) {
			recvInProgress = true;
		}
	}
}


void showNewData(void) {
  u8g.firstPage(); 
  if (newData == true) {
   
    if (strcmp(receivedChars, "011") == 0)
 {
      do {draw3(); 
      Serial.println("EAST");
       digitalWrite(13, HIGH);   
       delay(50);              
       digitalWrite(13, LOW);    
       delay(50);     
    }
      while( u8g.nextPage() ); 
    }
    else if (strcmp(receivedChars, "010") == 0)
    {
      do {draw2(); 
      Serial.println("NORTH EAST");
       digitalWrite(13, HIGH);   
       delay(50);              
       digitalWrite(13, LOW);    
       delay(50); 
    }
      while( u8g.nextPage() ); 
    }
     else if (strcmp(receivedChars, "110") == 0)
    {
      do {draw1(); 
      Serial.println("NORTH");
       digitalWrite(13, HIGH);   
       delay(50);              
       digitalWrite(13, LOW);    
       delay(50); 
    }
      while( u8g.nextPage() );
    }
     if (strcmp(receivedChars, "100") == 0)
    {
      do {draw6();
      Serial.println("SOUTH WEST");
       digitalWrite(13, HIGH);   
       delay(50);              
       digitalWrite(13, LOW);    
       delay(50); 
    }
      while( u8g.nextPage() );
    }
    else if (strcmp(receivedChars, "000") == 0)
    {
      do {draw5();
      Serial.println("SOUTH");
       digitalWrite(13, HIGH);   
       delay(50);              
       digitalWrite(13, LOW);    
       delay(50); 
    }
      while( u8g.nextPage() );
    }
     else if (strcmp(receivedChars, "001") == 0)
    {
      do{draw4();
      Serial.println("SOUTH EAST");
       digitalWrite(13, HIGH);   
       delay(50);              
       digitalWrite(13, LOW);    
       delay(50); 
    }
      while( u8g.nextPage() );
    }
     if (strcmp(receivedChars, "101") == 0)
    {
      do{draw7();
      Serial.println("WEST");
       digitalWrite(13, HIGH);   
       delay(50);              
       digitalWrite(13, LOW);    
       delay(50);  
    }
      while( u8g.nextPage() );
    }
      if (strcmp(receivedChars, "111") == 0)
    {
      do {draw8(); 
      Serial.println("NORTH WEST");
       digitalWrite(13, HIGH);   
       delay(50);              
       digitalWrite(13, LOW);    
       delay(50);  
    }
      while( u8g.nextPage() );
    }

    newData = false;
  }
  
}

. A few question here. How do i set as a default display when there is no input. Example " THANK YOU". Can u help me bob?