Diferencia entre revisiones de «Medidor de parpadeo de luz»

Página creada con «<pre> const int OVERLOAD_LED = 13; const int COLLECTION_MS = 200; const int DEAD_MS = 100; const int SENSOR_MAX = 800; void setup() { Serial.begin(9600); pinMode(OVERLOAD_LED, OUTPUT); } void loop() { int x_max = 0, x_min = 10000; unsigned long stop_ms = millis() + COLLECTION_MS; while (millis() < stop_ms) { int x = analogRead(A0); if (x > x_max) x_max = x; if (x < x_min) x_min = x; } digitalWrite(OVERLOAD_LED, x_max > SENSOR_MAX); float…»
 
Sin resumen de edición
Línea 1: Línea 1:
=Sensor=
* [[Media:Ti opt101.pdf | Texas Instruments OPT101 Hoja de Datos]]
=Codigo=
<pre>
<pre>