It has 12 pins that need to be connected to work. I've had it all working on the UNO and mapped those pins to the Flora that I'm using. I've soldered SPI pins and connected all cables to where they need to fit on the Flora, then loaded the same code that worked on the Uno (see code below), but unfortunately it doesn't work and the receiving client doesn't receive the ping.
As you can see in the photo below, there are a few LED lights on the Flora - I have a fixed red light as well as blinking yellow light plus the green power light. I'm mainly concerned of the fixed red light - I searched online and couldn't find what this actually means.
It might be due to one (or more) of the connections that I mapped incorrectly or that there is something wrong with the code. The mapping is based on the table below (I got a lot of help from the admin of this forum to build this table). The table includes the wiring for the UNO and the Flora. The connections for the UNO worked perfectly according to this diagram: http://blog.zakkemble.co.uk/wp-content/uploads/2013/01/nrf905_bb.png. Note I kept all resistors in place. Maybe that's the issue?
Regarding the code, it seems that I can't change the pin numbers as some of them have changed from the UNO to Flora (e.g. pin 8 on UNO is now D12 on Flora). However in the code the pin numbers are all commented so I can't change them. I'm just a beginner with Arduino and I'm not sure where I can actually change it. Is it somewhere in the libraries?
Any help would be greatly appreciated!!
Thanks :-)
This is the code for the RF Ping_Server:
- Code: Select all | TOGGLE FULL SIZE
/*
* Project: nRF905 AVR/Arduino Library/Driver
* Author: Zak Kemble, contact@zakkemble.co.uk
* Copyright: (C) 2013 by Zak Kemble
* License: GNU GPL v3 (see License.txt)
* Web: http://blog.zakkemble.co.uk/nrf905-avrarduino-librarydriver/
*/
/*
* Wait for data and reply.
*
* 7 -> CE
* 8 -> PWR
* 9 -> TXE
* 2 -> CD
* 3 -> DR
* 10 -> CSN
* 12 -> SO
* 11 -> SI
* 13 -> SCK
*/
#include <nRF905.h>
#include <SPI.h>
#define RXADDR {0x58, 0x6F, 0x2E, 0x10} // Address of this device (4 bytes)
#define TXADDR {0xFE, 0x4C, 0xA6, 0xE5} // Address of device to send to (4 bytes)
void setup()
{
// Start up
nRF905_init();
// Set address of this device
byte addr[] = RXADDR;
nRF905_setRXAddress(addr);
// Put into receive mode
nRF905_receive();
Serial.begin(9600);
Serial.println(F("Server started"));
}
void loop()
{
Serial.println(F("Waiting for ping..."));
// Make buffer for data
byte buffer[NRF905_MAX_PAYLOAD];
// Wait for data
while(!nRF905_getData(buffer, sizeof(buffer)));
Serial.println(F("Got ping"));
// Set address of device to send to
byte addr[] = TXADDR;
nRF905_setTXAddress(addr);
// Set payload data (reply with data received)
nRF905_setData(buffer, sizeof(buffer));
Serial.println(F("Sending reply..."));
// Send payload (send fails if other transmissions are going on, keep trying until success)
while(!nRF905_send());
// Put back into receive mode
nRF905_receive();
Serial.println(F("Reply sent"));
// Print out ping contents
Serial.print(F("Data: "));
Serial.write(buffer, sizeof(buffer));
Serial.println();
}