#include <Wire.h>
#include <BH1750.h>
#include <dht.h>
//#include <avr/sleep.h>

dht DHT;
//#define mosfetPin 9         //on board: 9
#define PinLED 10           //on board: 10   BLUE
#define PinLED2 14          //on board: 14   GRENN/BLUE
#define DHT11_PIN 15        //on board: 15   DHT11
#define PinLED3 16          //on board: 16   GRENN/BLUE  

int delayStep = 20;

int brightness = 0;
int maxBrightness = 255;

int loops = 3;
int i_loops = 1;  
int CurrentColor = PinLED2;
int CurrentColor2 = PinLED3;

BH1750 lightMeter;

void setup() {
  Serial.begin(9600);
  Wire.begin();
  lightMeter.begin();
  pinMode(PinLED, OUTPUT);
  pinMode(PinLED2, OUTPUT);
  pinMode(PinLED3, OUTPUT);
  digitalWrite(CurrentColor2, LOW);
  digitalWrite(CurrentColor, LOW);
}

void loop() {
//        Serrintln();
int chk = DHT.read11(DHT11_PIN);
  uint16_t lux = lightMeter.readLightLevel();
  Serial.print("Light: ");
  Serial.print(lux);
  Serial.println(" lx");


  Serial.print("Temp: ");
  Serial.print(DHT.temperature);
  Serial.println();
  Serial.print("Hum: ");
  Serial.print(DHT.humidity);
  Serial.println();
  Serial.println();
  delay(500);





//###############blok docelowej pętli
  if (lux < 10){  
      for (i_loops = 1; loops >= i_loops; i_loops++) {

       //żółte
        digitalWrite(CurrentColor, (maxBrightness*0,7));
        analogWrite(CurrentColor2, LOW);
        delay(10000);
        //niebieskie
        digitalWrite(CurrentColor, LOW);
        analogWrite(CurrentColor2, (maxBrightness*0,95));
        delay(10000);
       }
  }else {
    digitalWrite(CurrentColor2, LOW);
    digitalWrite(CurrentColor, LOW);    
    digitalWrite(PinLED, HIGH);
    delay(5); 
    digitalWrite(PinLED, LOW);
    delay(2000); 
}
//###############blok docelowej pętli




}
