i have 2 X RF-Nano's with an integrated rf module
Hardware link here
the idea is to send 3 sensors reading from temp sensors to witch the temp reading is working on the transmitter. but the transmission isn't or the receiver isn't receiving it
only got one temp sensor connected at the moment
transmitter code with LCD attached also
/********************************************************************/
// First we include the libraries
#include <OneWire.h>
#include <DallasTemperature.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <nRF24L01.h>
#include <RF24.h>
Adafruit_SSD1306 display(-1);
/********************************************************************/
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
/********************************************************************/
// Setup a oneWire instance to communicate with any OneWire devices
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
/********************************************************************/
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
/********************************************************************/
RF24 radio(9, 10);
const uint64_t pipe = 0xE8E8F0F0E1LL;
void setup(void)
{
// start serial port
Serial.begin(9600);
Serial.println("Dallas Temperature IC Control Library Demo");
// Start up the library
sensors.begin();
radio.begin();
radio.openWritingPipe(pipe);
// initialize with the I2C addr 0x3C
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
// Clear the buffer.
display.clearDisplay();
// Display Text
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,28);
display.println("Hello world!");
display.display();
delay(2000);
display.clearDisplay();
}
void loop(void)
{
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
/********************************************************************/
Serial.print(" Requesting temperatures...");
sensors.requestTemperatures(); // Send the command to get temperature readings
Serial.println("DONE");
/********************************************************************/
Serial.print("Temperature is: ");
Serial.print(sensors.getTempCByIndex(0)); // Why "byIndex"?
float tempc = sensors.getTempCByIndex(0);
radio.write(&tempc, sizeof(float));
// You can have more than one DS18B20 on the same bus.
// 0 refers to the first IC on the wire
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.drawRoundRect(0, 18, 120, 35, 8, WHITE);
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(38,0);
display.println("Temp");
display.setTextSize(3);
display.setCursor(18,25);
display.println(sensors.getTempCByIndex(0));
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(35,57);
display.println("Degrees C");
display.display();
delay(2000);
display.clearDisplay();
delay(1000);
}
and receiver code Just on its own at the moment
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Wire.h>
float temperature, temp2;
RF24 radio(9, 10);
const uint64_t pipes[3] = { 0xE8E8F0F0E1LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL };
void setup(void) {
Serial.begin(9600);
radio.begin();
radio.setDataRate(RF24_250KBPS);
radio.openReadingPipe(1, pipes[1]);
radio.openReadingPipe(2, pipes[2]);
radio.startListening();
delay(1000);
}
void loop(void)
{
if ( radio.available() )
{
delay(50);
radio.read(&temperature, sizeof(temperature));
Serial.print("temperature");
Serial.print(temperature);
Serial.println(" C");
delay(50);
radio.read(&temperature, sizeof(temperature));
Serial.print("Temp 2");
Serial.print(temp2);
Serial.println(" C");
}
else
{
Serial.println("No radio available");
}
delay(1000);
}
tranmitter serial output is
Requesting temperatures...DONE
Temperature is: 25.44
reciver output is
08:41:42.541 -> temperature0.00 C
what am i missing