@@ -182,11 +182,12 @@ float Treppe::read_ldr() | |||
= 37280.00/analogRead(A0) | |||
ldr_ohm = R(LDR) | |||
E(LDR) = 79.735 * R(LDR)^-0.498 (see Excel Regression) | |||
E(LDR) = 6526.5 * R(LDR)^-2 (see Excel Regression) | |||
E(LDR) = 6526.5 / (R(LDR)^2) | |||
ldr_value = E(LDR) | |||
*/ | |||
float ldr_ohm = 37280.00 / analogRead(A0); | |||
float ldr_value = 79.735 * pow(ldr_ohm, -0.498); | |||
float ldr_value = 6526.6/(ldr_ohm*ldr_ohm); | |||
return ldr_value; | |||
} | |||
@@ -5,7 +5,7 @@ | |||
// #define LDRDEBUG // comment in to override LDR measurement | |||
#define LDR_HYS 5.0 // Hysteresis for switching off FSM [lux] | |||
#define LDR_HYS 1 // Hysteresis for switching off FSM [lux] | |||
#define SENSOR_OBEN 16 | |||
#define SENSOR_UNTEN 12 | |||
@@ -21,7 +21,7 @@ private: | |||
uint16_t idle_pwm_internal = 0; | |||
uint16_t active_pwm = 700; | |||
uint16_t ldr_schwelle = 7; // activation value for FSM [lx] | |||
uint16_t ldr_schwelle = 2; // activation value for FSM [lx] | |||
uint16_t start_pwm = 0; | |||
uint16_t ziel_pwm = 0; |