This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Recognising a received uart character

I've been having a little bit of an issue trying to parse UART data that I am receiving from an external device.

Where I'm having issues right now is comparing an incoming byte with a specific character. I'm looking for the '+' character, but I get errors when I compare this to my buffer.

Here's a test I did:

unsigned char buffer[10];

static void fifo_handler(void)
{

	char * test = "+";
	app_uart_get(&buffer[0]);

	if(buffer[0] == (unsigned char)test)
	{
			printf("hurray");
	}

}

I get a true condition and a 'hurray' printed on my terminal when I type an 'l' not a '+' though?

Also, if I had to parse a longer string an extract one piece of info from it, is this the right way to go about it? (I'm also using a soft device).

Related