Hi people. I have a little question to ask. Today I made this sketch for arduino uno. This sketch let me read temperature and humidity on a lcd i2c and it works great. But in this way, it works alone. I would like to connect it to domoticz. So I have to add radio and relative child id
(#define CHILD_ID_HUM 0
#define CHILD_ID_TEMP 1)
to the sketch to connect it in Domoticz.
this is the sketch:
//Libraries
#include <DHT.h>
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
//Constants
#define DHTPIN 4 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino
//ALWAYS USE THIS WITH LCD I2C and Addres 0x3F
#define I2C_ADDR 0x3F
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
//Variables
int chk;
float hum; //Stores humidity value
float temp; //Stores temperature value
void setup()
{
Serial.begin(9600);
dht.begin();
lcd.begin(16,2);
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
}
void loop()
{
delay(2000);
//Read data and store it to variables hum and temp
hum = dht.readHumidity();
temp = dht.readTemperature();
//Print temp and humidity values to serial monitor
Serial.print("Humidity: ");
Serial.print(hum);
Serial.print(" %, Temp: ");
Serial.print(temp);
Serial.println(" Celsius");
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Temp: ");
lcd.print(temp);
lcd.print(" ");
lcd.print((char)223);
lcd.print("C");
lcd.setCursor(0,1);
lcd.print("Hum: ");
lcd.print(hum);
lcd.print(" %");
delay(2000); //Delay 2 sec.
}
so, can you help me to add radio NRF24 and connect it to domoticz?
Thanks so much from Italy