@haloway13
Hey, as I said below, I have found a solution to the problem.
I have made use of two other tutorials.
(Attention German language!)
https://draeger-it.blog/arduino-lektion-48-temperatursensor-ds18b20/
https://tutorials-raspberrypi.de/funkkommunikation-zwischen-raspberry-pis-und-arduinos-2-4-ghz/
If you look at the wiring, I can send you my code so far:
#include <SPI.h>
#include "printf.h"
#include "RF24.h"
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2 //Sensor DS18B20 at digital pin 2
RF24 radio(7, 8); // using pin 7 for the CE pin, and pin 8 for the CSN pin
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire); // Transfer of the OnewWire reference to communicate with the sensor.
uint8_t address[][6] = {"1Node", "2Node"}; // Let these addresses be used for the pair
bool radioNumber = 1; //to use different addresses on a pair of radios, we need a variable to uniquely identify which address this radio will use to transmit
int sensorCount;
float payload = 0.0;
int ID = 0;
float temperature = 0.0;
float battery = 0.0;
void setup() {
Serial.begin(115200);
while (!Serial) {
// some boards need to wait to ensure access to serial over USB
}
// initialize the transceiver on the SPI bus
if (!radio.begin()) {
Serial.println(F("radio hardware is not responding!!"));
while (1) {} // hold in infinite loop
}
// Set the PA Level low to try preventing power supply related problems
// because these examples are likely run with nodes in close proximity to
// each other.
radio.setPALevel(RF24_PA_LOW); // RF24_PA_MAX is default.
sensors.begin(); // Start communication with the sensor
sensorCount = sensors.getDS18Count(); // Reading the number of connected
// save on transmission time by setting the radio to only transmit the
// number of bytes we need to transmit a float
radio.setPayloadSize(sizeof(payload)); // float datatype occupies 4 bytes
// set the TX address of the RX node into the TX pipe
radio.openWritingPipe(address[radioNumber]); // always uses pipe 0
// set the RX address of the TX node into a RX pipe
radio.openReadingPipe(1, address[!radioNumber]); // using pipe 1
radio.stopListening(); // put radio in TX mode
} // setup
void loop() {
if(sensorCount ==0){
Serial.println("No temperature sensors found");
Serial.println("Please check your circuit!");
}
sensors.requestTemperatures();
// This device is a TX node
payload = sensors.getTempCByIndex(0);
unsigned long start_timer = micros(); // start the timer
bool report = radio.write(&payload, sizeof(float)); // transmit & save the report
unsigned long end_timer = micros(); // end the timer
if (report) {
Serial.print(F("Transmission successful! ")); // payload was delivered
Serial.print(F("Time to transmit = "));
Serial.print(end_timer - start_timer); // print the timer result
Serial.print(F(" us. Sent: "));
Serial.println(payload); // print payload sent
} else {
Serial.println(F("Transmission failed or timed out")); // payload was not delivered
}
// to make this example readable in the serial monitor
delay(1000); // slow transmissions down by 1 second
} // loop