Use Arduino Mega 2560 as both Master and Slave via SPI

Here's the general layout of what I'm trying to do.

In LabView, I have an FPGA that sends a byte of information to my Arduino Mega via SPI. I am currently able to capture the bytes and successfully display it to my serial monitor. My Mega acts a slave in this case, the FPGA being the master.

What I want to do next is take that byte (let's say it's 150 in decimal), and use it to test an "if" condition in order to light an LED.

This is where I want to introduce an SPI-incorporated single-channel digital pot (MCP4151). If the byte in decimal form being transferred is 150, I want to use the Mega to send 150 to the digital pot to represent the wiper step. The MCP4151 has 0-255 steps, and it's a 50k ohm max. If the 150 gets there, my LED will light up to such a brightness.

Before I try that second task I want to know if this is even possible? Using the Arduino Mega first as a slave, then as a master. Or any other Arduino board for that matter (I will get the necessary board if need be).