Hi there!
I am a newbie in Arduino, and I kinda have a problem.
Recently, I have started a project that uses Arduino Uno and its sensors to measure temperature and humidity, and transmit the data from an arduino to another. The problem I encounter now is that I cannot receive the data from the uno.
Here is the code for transmission uno:
#include <nRF24L01.h>
#include <printf.h>
#include <RF24.h>
#include <RF24_config.h>
#include <SPI.h>
#include <dht.h>
dht DHT; // sensing unit
#define DHT11_PIN 8
RF24 radio(9,10); // transmit unit
const byte address[6] = "00001";
void setup() {
// first, setup communication
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
}
void loop() {
// humidNtemp execution:
delay(1000);
radio.stopListening();
int SensorValue = DHT.read11(DHT11_PIN);
radio.write(&SensorValue, sizeof(SensorValue));
And here is the code for receive uno:
#include <nRF24L01.h>
#include <printf.h>
#include <RF24.h>
#include <RF24_config.h>
#include <SPI.h>
RF24 radio(9,10);
const byte address[6] = "00001";
void setup() {
// setup screen:
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
}
void loop() {
// put your main code here, to run repeatedly:
delay(1000);
radio.startListening();
if (radio.available()) {
while (radio.available()) {
int SensorV = 0;
radio.read(&SensorV, sizeof(SensorV));
Serial.print("Temperature = ");
Serial.println(SensorV);
Serial.print("Humidity = ");
Serial.println(SensorV);
delay(1000);
}
}
I'm pretty sure that the program has mistakes, here and there. I am not sure where and how to encounter it. I have use quite a number of reference and codes to make it work, but I don't know. So, if anyone who read this post, can you please help me? I appreciate your kindness. Thank you.