I tried making a function and did this
#include <dht.h>
#include <LiquidCrystal.h>
#include <IRremote.h>
#include <IRremoteInt.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
dht DHT;
int RECV_PIN = 10;
IRrecv receiver(RECV_PIN);
decode_results results;
#define DHT11_PIN 9
int vodaPin = A5;
int voda;
int photocellPin = A0;
int svjetlo;
const int numReadings = 7;
int readings[numReadings];
int readIndex = 0;
int total = 0;
int average = 0;
void svjetlost(){
svjetlo = analogRead(photocellPin);
delay(10);
lcd.setCursor(0, 0);
lcd.print("Svjetlost:");
lcd.print(svjetlo);
lcd.noDisplay();
delay(100);
lcd.display();
delay(500);
}
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
lcd.begin(16, 2);
receiver.enableIRIn();
}
void loop()
{
if (receiver.decode(&results)) {
if (results.value == 0xFF30CF ) {
}
if (results.value == 0xFF18E7) {
svjetlost();
}
if (results.value == 0xFF7A85) {
}
receiver.resume();
}
}
[code]
But it still doesn't work.