SPI communication on arduino uno

Hi all
I am trying to communicate using SPI protocol between two arduino uno boards. I have writthen a very simple code to transfer a single character from master. The code is as following

#include <SPI.h>
#include "pins_arduino.h"

void setup (void)
{
}


void loop (void)
{

  
  digitalWrite(SS, HIGH);  // ensure SS stays high

  SPI.begin ();

  delay (5000);  // 5 seconds delay to start logic analyser.
 
  // enable Slave Select
  digitalWrite(SS, LOW);    // SS is pin 10
  
  // send test string
    SPI.transfer ( 'c');

 // disable Slave Select
 digitalWrite(SS, HIGH);

 // turn SPI hardware off
 SPI.end ();
 
 while (1);  //loop
}

Please correct the code if its not right. And I really want to know that how to recieve that character on arduino uno in slave mode. There is a command SPI.transfer() to send data on SPI where as I haven’t seen any command to recieve it.

Thanks and regards

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

Nick Gammon has an excellent writeup on SPI, including master/slave data exchange, at:

Good luck!

You cross-post one more time and I will ban you.

Thanks magagna...
One thing is clear to me that when using the command of SPI.transfer() both the MOSI and MISO are clocked out and in respectively. Now the question is how to grab the bit coming on MISO if my arduino is Master.

On Nick Gammon's page see the section "how to get a response from a slave". Specifically the code line

byte a = SPI.transfer (what);

On the master you call SPI.transfer() to send a byte to the slave, and the function returns the byte coming from the slave.

Thanks magagna...
I have learnt how to communicate bi-directionally...
Regards