#ifndef SENSOR_LUZ_H
#define SENSOR_LUZ_H

#include <Arduino.h>
#include <math.h>

#define UMBRAL 1000
#define UMBRAL2 750
#define UMBRAL_GRANDE 2500

enum Level
{
    low,
    medium_low,
    medium,
    medium_high,
    high
};

enum Tilt
{
    low_tilt,
    medium_tilt,
    high_tilt
};

class sensor_luz
{
public:
    sensor_luz(int sensor0, int sensor1, int sensor2, int sensor3)
    {
        this->sensor0 = sensor0;
        this->sensor1 = sensor1;
        this->sensor2 = sensor2;
        this->sensor3 = sensor3;
        this->sensorValue0 = 0;
        this->sensorValue1 = 0;
        this->sensorValue2 = 0;
        this->sensorValue3 = 0;
        this->nivel = low;
        this->tilt = low_tilt;
    };
    ~sensor_luz(){};

    int get_level_tildado();
    int get_level_altura();
    void read_ldr();

private:
    int sensor0, sensor1, sensor2, sensor3;
    int sensorValue0, sensorValue1, sensorValue2, sensorValue3;
    enum Level nivel;
    enum Tilt tilt;
    void check_level(int sensorActual, int sensorAnterior, int sensorSiguiente, enum Level nivel);
    void check_tilt(int sensor, enum Tilt tilt, enum Level nivel);
};

#endif