Using data received from SPI

Hello,

I know this might be a stupid question but I just want to be sure.

So I'm setting up an SPI and I understand that storing the value received over SPI is usually accomplished by doing this (using generic names):

byte received = SPI.transfer(whatever I'm sending)

So received is a byte.

What I need to do next is, based on the byte received, do an action. For example (onde again using generic names and Im certain the code written is not correct - THATS WHAT I NEED HELP WITH!):

Imagine the byte received is 00000000.

int values[256] = {00000000, 00000001, ... };
int morevalues[256] = {the numbers inside are specific for each byte on the values array};

for (int i=0; i<256; i++)
if received == values[i]
action = morevalues[i];
else
(not sure what to put here also, i just want do add 1 to i and keep going)

Im not sure Im being clear about my problem. Maybe its obvious, but I just need someone to tell me if this is possible and how to do it...

I think you just need braces

for (int i=0; i<256; i++)
{
if received == values[i]
action = morevalues[i];
}

CrossRoads:
I think you just need braces

for (int i=0; i<256; i++)

{
if received == values[i]
action = morevalues[i];
}

Ok didnt notice that, but will it do what I want?

tomaseferreira:
Ok didnt notice that, but will it do what I want?

Compile / Upload it and tell us if there are any errors.