Hello All,
This is my first post so I hope I am posting this correctly.
I am working on a very basic project to connect a type K thermo couple to an Arduino UNO/Mega and have it transmit the temp data to another UNO/Mega by using the NRF24L01. I have had great success with the NRF boards in the past and enjoy using them.
I have hooked everything up and am able to read the thermocouple on the transmitting UNO. The issue arises when I try to transmit that temp to the receive UNO/Mega. It is returning a "nan" statement in the serial.println. I do know that my wiring and transmitting properties are ok as I am transmitting a "Hello World" message along side the temps and that works each time. I've been working on this for some time and would really appreciate any help you could give.
//Transmit
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <MAX6675_Thermocouple.h>
RF24 radio(7, 8);
MAX6675_Thermocouple ktemp1 (6, 5, 4);// Create a Module (CLK, CS, SO)
const byte rxAddr[6] = "00001";
//int soPin = 4;
//int csPin = 5;
//int sckPin = 6;
void setup()//***********************************************setup
{
Serial.begin(9600);
radio.begin();
radio.setRetries(15, 15);
radio.openWritingPipe(rxAddr);
radio.stopListening();
}
void loop()
{
double jobTemp = ktemp1.readCelsius();
Serial.println(jobTemp);
radio.write(&jobTemp, sizeof(jobTemp));
Serial.println(jobTemp);
const char text[] = "Hello World";
radio.write(&text, sizeof(text));
delay(3000);
}
//Recieve Code
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <MAX6675_Thermocouple.h>
RF24 radio(46, 47);
MAX6675_Thermocouple ktemp1 (6, 5, 4);// Create a Module (CLK, CS, SO)
const byte rxAddr[6] = "00001";
void setup()
{
while (!Serial);
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, rxAddr);
radio.startListening();
}
void loop()
{
if (radio.available())
{
char text[32] = {0};
radio.read(&text, sizeof(text));
Serial.println(text);
radio.read(&ktemp1, sizeof(ktemp1));
Serial.println(ktemp1.readCelsius());
}
}