All am scratching my head down to the bare bone trying to figure out how to get these two devices to play nice with each other.
The radio seems to take over the SPI bus and will not free it up. If I do not initialize the radio I am able to read the temperature probes without any issues but as soon as I initialize/start the radio I loose my temperature readings.
I am using the maniacbug library with he radio setup in a network mode. Bellow one of the sketches that I have been tinkering with.
I have even went as far as modifying the library to add a function to set the CSN pin to HIGH/LOW and I could see pin 10 going high and low but I still couldn't read my temperature sensor.
If anyone has any recommendations it would be greatly appreciated.
#include <SPI.h>
#include <RF24Network.h>
#include <RF24.h>
#include "max6675.h"
MAX6675 tempProbe(13,7,12);
//nRF24 set the pin 9 to CE and 10 to CSN/SS
// Cables are:
// SS -> 10
// MOSI -> 11
// MISO -> 12
// SCK -> 13
RF24 radio(9,10);
RF24Network network(radio);
const uint16_t this_node=1;
const uint16_t master_node=0;
// How often to send 'hello world to the other unit
const unsigned long interval = 2000; //ms
// When did we last send?
unsigned long last_sent;
// How many have we sent already
unsigned long packets_sent;
struct payload_t
{
unsigned long ms;
unsigned long counter;
};
void setup(void)
{
Serial.begin(57600);
Serial.println("RF24Network/examples/helloworld_tx/");
SPI.begin();
radio.begin();
network.begin(/*channel*/ 90, /*node address*/ this_node);
}
void loop()
{
// Pump the network regularly
network.update();
// If it's time to send a message, send it!
unsigned long now = millis();
if ( now - last_sent >= interval )
{
last_sent = now;
Serial.print("Sending...");
payload_t payload = { getTemp(), packets_sent++ };
RF24NetworkHeader header(/*to node*/ master_node);
bool ok = network.write(header,&payload,sizeof(payload));
if (ok)
Serial.println("ok.");
else
Serial.println("failed.");
}
}
float getTemp()
{
return tempProbe.readCelsius();
}