Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <SimpleDHT.h>

int pin = A0;;
SimpleDHT11 dht11(pin );
float temp;
float humi;
 

float temperature[2];
 
double Fahrenheit(double celsius) {
return ((double)(9 / 5) * celsius) + 32;
}
 
double Kelvin(double celsius) {
return celsius + 273.15;
}
 
RF24 radio(8, 9);
const uint64_t pipe = 0xE8E8F0F0E1LL;
 
void setup(void) {
radio.begin();
radio.openWritingPipe(pipe);
}
 
void loop(void)
{
float temp, humi;
SimpleDHT11.read(&temp, &humi);
temperature[0] = temp;
temperature[1] = humi;
radio.write(temperature, sizeof(temperature));
delay(1000);
}


What I have tried:

<pre>#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <SimpleDHT.h>

int pin = A0;;
SimpleDHT11 dht11(pin );
float temp;
float humi;
 

float temperature[2];
 
double Fahrenheit(double celsius) {
return ((double)(9 / 5) * celsius) + 32;
}
 
double Kelvin(double celsius) {
return celsius + 273.15;
}
 
RF24 radio(8, 9);
const uint64_t pipe = 0xE8E8F0F0E1LL;
 
void setup(void) {
radio.begin();
radio.openWritingPipe(pipe);
}
 
void loop(void)
{
float temp, humi;
SimpleDHT11.read(&temp, &humi);
temperature[0] = temp;
temperature[1] = humi;
radio.write(temperature, sizeof(temperature));
delay(1000);
}
Posted
Updated 21-Apr-21 6:02am

1 solution

SimpleDHT11 (I assume) is the name of the class, you should be using the instance name that you previously declared.
C++
dht11.read(&temp, &humi); // use the instance name
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900