proyectos:talleres:ets
Diferencias
Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previa | ||
| proyectos:talleres:ets [2023/10/03 13:44] – [Ejemplo básico] elmago116 | proyectos:talleres:ets [2025/01/04 11:04] (actual) – elmago116 | ||
|---|---|---|---|
| Línea 5: | Línea 5: | ||
| {{: | {{: | ||
| {{: | {{: | ||
| + | |||
| + | Los nombres de algunos sensores diseñados: | ||
| + | |||
| + | {{: | ||
| + | |||
| Línea 96: | Línea 101: | ||
| <file c++ ejemplo.ino> | <file c++ ejemplo.ino> | ||
| + | // Configurar - sujeto | ||
| #include < | #include < | ||
| #define LED_PIN D3 | #define LED_PIN D3 | ||
| Línea 106: | Línea 111: | ||
| #define azul CRGB::Blue | #define azul CRGB::Blue | ||
| #define colornuevo 0x00FF00 | #define colornuevo 0x00FF00 | ||
| - | |||
| const uint8_t matrixWidth | const uint8_t matrixWidth | ||
| Línea 118: | Línea 122: | ||
| const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz) | const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz) | ||
| unsigned int sample; | unsigned int sample; | ||
| - | |||
| - | void setup() { | ||
| - | Serial.begin(115200); | ||
| - | LEDS.addLeds< | ||
| - | FastLED.setBrightness(BRIGHTNESS); | ||
| - | } | ||
| #define ESCENAS 1 | #define ESCENAS 1 | ||
| Línea 138: | Línea 136: | ||
| }, | }, | ||
| }; | }; | ||
| - | + | ||
| + | void setup() { | ||
| + | Serial.begin(115200); | ||
| + | LEDS.addLeds< | ||
| + | FastLED.setBrightness(BRIGHTNESS); | ||
| + | } | ||
| + | |||
| + | // Ejecutar en loop - predicado | ||
| void loop() { | void loop() { | ||
| - | for(int i = 0; i< matrixHeight; | + | |
| - | for(int j = 0; j< matrixWidth; | + | |
| - | leds[i*matrixWidth + j] = matrix[loop_cnt%ESCENAS][i][j]; | + | |
| - | } | + | |
| - | | + | |
| unsigned long startMillis = millis(); | unsigned long startMillis = millis(); | ||
| unsigned int peakToPeak = 0; | unsigned int peakToPeak = 0; | ||
| Línea 168: | Línea 170: | ||
| } | } | ||
| | | ||
| + | |||
| + | // Cambia brillo según segun nivel de sonido | ||
| int changeBrightness = map(peakToPeak, | int changeBrightness = map(peakToPeak, | ||
| | | ||
| + | | ||
| + | // Pinta la matriz de leds | ||
| + | for(int i = 0; i< matrixHeight; | ||
| + | for(int j = 0; j< matrixWidth; | ||
| + | leds[i*matrixWidth + j] = matrix[loop_cnt%ESCENAS][i][j]; | ||
| + | } | ||
| + | } | ||
| + | | ||
| | | ||
| | | ||
proyectos/talleres/ets.1696340689.txt.gz · Última modificación: por elmago116
