 
 /***** NB FOR MOTOR BOARD ***/
 
-#define DEVICE_ID 'D';
+#define DEVICE_ID 'D'
  
 //#define RX_ADDRESS "AAAAA"
 //#define RX_ADDRESS "BBBBB"

#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"

#define PIN_CE  SCL
#define PIN_CSN SDA


void processPayload()
{
  rx_payload.unserialize(rx);
  
  // Create an internal transfer buffer of the relevant data.  
  //@todo provide usful data for the top board
  tx_buf[0] = rx_payload.getType(); 
  tx_buf[1] = rx_payload.getDeviceId();
  tx_buf[2] = (rx_payload.getId() >> 8); 
  tx_buf[3] = rx_payload.getId(); 
  tx_buf[4] = (rx_payload.getA() >> 8); 
  tx_buf[5] = rx_payload.getA(); 
  tx_buf[6] = (rx_payload.getB() >> 8); 
  tx_buf[7] = rx_payload.getA(); 
  
    
  // Proof of concept
  if (rx_payload.getA() == 70) {
    radio.stopListening();
    
    // Prepare the message.
    Nrf24Payload tx_payload = Nrf24Payload();      
    tx_payload.setDeviceId(DEVICE_ID);
    tx_payload.setType('q'); // light command
    tx_payload.setTimestamp(millis());
    tx_payload.setId(msg_id++);
    tx_payload.setA(99);
    
    uint8_t tx_buffer[Nrf24Payload_SIZE];
    tx_payload.serialize(tx_buffer);

    //printf("sending %d, %d \n", payload.msg_id, payload.a);    
    if (!radio.write( &tx_buffer, Nrf24Payload_SIZE)) { 
      //printf(" failed.\n\r"); 
    }
    
    radio.startListening(); 
  } 
  
  int c = rx_payload.getC();
  int d = rx_payload.getD();
  
  if (c > 0) {
    // Left motor command
    if (c > 255) {
      // Forward 0 -> 255
      speedL = constrain(c - 255, 0, 255);
    } else {
      // Backward -1 -> -255
      speedL = 1 - constrain(c , 0, 255);
    }
  } else {
    speedL = 0; // stopped
  }
  
  if (d > 0) {
    // Right motor command
    if (d > 255) {
      // Forward 0 -> 255
      speedR = constrain(d - 255, 0, 255);
    } else {
      // Backward -1 -> -255
      speedR = 1 - constrain(d , 0, 255);
    }
  } else {
    speedR = 0; // stopped
