Issues using both SPI and VirtualWire on Nano

I am using a simple 433MHz to transmit the three axis data from an ADXL345 accelerometer but found that VirtualWire for the wireless link and SPI for the accelerometer interfere with each other.

The cause is that the VirtualWire library uses default pins of D10, D11 and D12 which on the UNO, NANO and others are the dedicated pins for SPI.
The trick is to initialize the VirtualWire connection with different pins first BEFORE creating an SPI connection, as follows:

Hope that this helps!

void setup(){
// Initialise the Receiver IO and ISR
// NOTE: VirtualWire default pins use D10, D11 and D12 which interfere with SPI so initialise FIRST!
vw_setup(txRate); // speed of data transfer Kbps
vw_set_tx_pin(txPin);
vw_set_ptt_inverted(true); // Required for RF Link module

SPI.begin(); // Initiate an SPI communication instance.
SPI.setDataMode(SPI_MODE3); // Configure the SPI connection for the ADXL345.
pinMode(CS, OUTPUT); // Set up the Chip Select pin to be an output from the Arduino.
digitalWrite(CS, HIGH); // Before communication starts, the Chip Select pin needs to be set high.

Serial.begin(57600); // Create a serial connection to display the data on the terminal.

writeRegister(DATA_FORMAT, 0x01); // Put ADXL345 into +/- 4G range by writing 0x01 to DATA_FORMAT register.
writeRegister(POWER_CTL, 0x08); // Put ADXL345 into Measurement Mode by writing 0x08 to POWER_CTL register.
}

Most simple 433 MHz modules do not use Push To Talk, I don't think this is needed:

vw_set_ptt_inverted(true); // Required for RF Link module