proyectos:talleres:ets
Diferencias
Muestra las diferencias entre dos versiones de la página.
Próxima revisión | Revisión previaPróxima revisiónAmbos lados, revisión siguiente | ||
proyectos:talleres:ets [2021/11/11 01:46] – creado elmago116 | proyectos:talleres:ets [2023/10/03 13:44] – [Ejemplo básico] elmago116 | ||
---|---|---|---|
Línea 1: | Línea 1: | ||
- | Estructura | + | ====== El taller ====== |
- | Recursos | + | {{: |
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | |||
+ | |||
+ | ====== Videos ====== | ||
+ | ===== Sesión 1 ===== | ||
+ | |||
+ | *concierto solenoide: https:// | ||
+ | |||
+ | *Processing & Kinect Sensor: Finger Tracking + OSCP5 + Pure Data + Arp2600 https:// | ||
+ | |||
+ | *Experimento de resonancia acustica: https:// | ||
+ | *Graffiti Laser: http:// | ||
+ | *Delicate boundaries: http:// | ||
+ | *Licuadora que funciona con gruñidos: | ||
+ | *Almacenador de gritos: https:// | ||
+ | *Drawdio: https:// | ||
+ | *sensor pez: https:// | ||
+ | *planta feliz: https:// | ||
+ | *juego de cubos en una caja : | ||
+ | *pelotica: | ||
+ | *pez automata: | ||
+ | *concierto de 8bits: https:// | ||
+ | *Lista de reproduccion: | ||
+ | *galería de algunos sensores: | ||
+ | *multimedia de jugetes: https:// | ||
+ | *Taller de aire y vestuario: https:// | ||
+ | |||
+ | ===== Sesión 2 ===== | ||
+ | |||
+ | **Para generar ideas:** | ||
+ | |||
+ | Sensores de calidad del aire y weareables: https:// | ||
+ | |||
+ | ===== Fanzine con manual de instalación | ||
+ | |||
+ | {{: | ||
+ | |||
+ | |||
+ | {{ : | ||
+ | ===== Sesión 3 ===== | ||
+ | |||
+ | **Para crear los conceptos: | ||
+ | |||
+ | Comprender el mundo a través de los datos: | ||
+ | {{youtube> | ||
+ | |||
+ | **¿Para que sirven los datos?** | ||
+ | |||
+ | https:// | ||
+ | |||
+ | http:// | ||
+ | ====== Componentes ====== | ||
+ | |||
+ | ===== ESP 8266 ===== | ||
+ | {{: | ||
+ | |||
+ | ===== Micrófono ===== | ||
+ | {{: | ||
+ | |||
+ | |||
+ | ==== Amplificador ==== | ||
+ | https:// | ||
+ | |||
+ | ===== Matriz de leds ===== | ||
+ | {{: | ||
+ | |||
+ | |||
+ | |||
+ | ====== Aplicación Android====== | ||
+ | |||
+ | https:// | ||
+ | |||
+ | ====== Entorno para desktop ====== | ||
+ | |||
+ | Windows: | ||
+ | ====== Github y Código ====== | ||
+ | |||
+ | **Repositorios de github:** | ||
+ | https:// | ||
+ | |||
+ | **Repositorio del código sesión 2: intensidad** | ||
+ | |||
+ | https:// | ||
+ | |||
+ | **Descargar repositorio codigo para programar una " | ||
+ | |||
+ | https:// | ||
+ | |||
+ | ==== Ejemplo básico ===== | ||
+ | <file c++ ejemplo.ino> | ||
+ | |||
+ | |||
+ | #include < | ||
+ | #define LED_PIN D3 | ||
+ | #define LED_TYPE WS2812B | ||
+ | #define COLOR_ORDER GRB | ||
+ | #define amarillo CRGB:: | ||
+ | #define negro CRGB::Black | ||
+ | #define rojo CRGB::Red | ||
+ | #define azul CRGB:: | ||
+ | #define colornuevo 0x00FF00 | ||
+ | |||
+ | |||
+ | const uint8_t matrixWidth | ||
+ | const uint8_t matrixHeight = 8; | ||
+ | #define NUM_LEDS (matrixWidth * matrixHeight) | ||
+ | |||
+ | int BRIGHTNESS = 60; | ||
+ | CRGB leds[matrixWidth * matrixHeight]; | ||
+ | |||
+ | int loop_cnt = 0; | ||
+ | const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz) | ||
+ | unsigned int sample; | ||
+ | |||
+ | void setup() { | ||
+ | Serial.begin(115200); | ||
+ | LEDS.addLeds< | ||
+ | FastLED.setBrightness(BRIGHTNESS); | ||
+ | } | ||
+ | |||
+ | #define ESCENAS 1 | ||
+ | CRGB matrix[ESCENAS][8][8] = { | ||
+ | { | ||
+ | {azul, azul, azul,azul, azul, azul, azul, | ||
+ | {azul, azul, azul,azul, azul, azul, azul, | ||
+ | {azul, azul, azul,azul, azul, azul, azul, | ||
+ | {azul, azul, azul,azul, azul, azul, azul, | ||
+ | {azul, azul, azul,azul, azul, azul, azul, | ||
+ | {azul, azul, azul,azul, azul, azul, azul, | ||
+ | {azul, azul, azul,azul, azul, azul, azul, | ||
+ | {azul, azul, azul,azul, azul, azul, azul, | ||
+ | }, | ||
+ | }; | ||
+ | |||
+ | 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 int peakToPeak = 0; | ||
+ | |||
+ | unsigned int signalMax = 0; | ||
+ | unsigned int signalMin = 1024; | ||
+ | |||
+ | // collect data for 50 mS | ||
+ | while (millis() - startMillis < sampleWindow) | ||
+ | { | ||
+ | sample = analogRead(0); | ||
+ | if (sample < 1024) { | ||
+ | if (sample > signalMax) | ||
+ | { | ||
+ | signalMax = sample; | ||
+ | } | ||
+ | else if (sample < signalMin) | ||
+ | { | ||
+ | signalMin = sample; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | } | ||
+ | | ||
+ | int changeBrightness = map(peakToPeak, | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | FIXME | ||
+ | |||
+ | ==== Librería para escribir en la matriz ==== | ||
+ | FIXME | ||
+ | |||
+ | <file c++ libmatrix.ino> | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #define LED_PIN D3 | ||
+ | #define LED_TYPE WS2812B | ||
+ | #define COLOR_ORDER GRB | ||
+ | |||
+ | /* | ||
+ | ** | ||
+ | ** https:// | ||
+ | ** https:// | ||
+ | ** https:// | ||
+ | ** https:// | ||
+ | ** | ||
+ | */ | ||
+ | |||
+ | #define amarillo CRGB:: | ||
+ | #define negro CRGB:: | ||
+ | #define rojo CRGB::Red | ||
+ | #define azul CRGB:: | ||
+ | #define morado CRGB:: | ||
+ | #define naranja CRGB:: | ||
+ | #define verde CRGB:: | ||
+ | #define aguamarina CRGB:: | ||
+ | #define rosado CRGB:: | ||
+ | #define verdedos CRGB:: | ||
+ | #define raro CRGB:: | ||
+ | #define rarodos CRGB:: | ||
+ | #define maplv1 0x00FF00 | ||
+ | #define maplv2 0x00AA00 | ||
+ | #define maplv3 0xFFFF00 | ||
+ | #define maplv4 0xFFE994 | ||
+ | #define maplv5 0xFFAA00 | ||
+ | #define maplv6 0xEC9BA4 | ||
+ | #define maplv7 0xE1AA00 | ||
+ | #define maplv8 0xFF00FF | ||
+ | #define maplv9 0x00DAFE | ||
+ | #define maplv10 0x0181FE | ||
+ | |||
+ | const uint8_t matrixWidth = 8; | ||
+ | const uint8_t matrixHeight = 8; | ||
+ | #define NUM_LEDS (matrixWidth * matrixHeight) | ||
+ | |||
+ | int BRIGHTNESS = 10; | ||
+ | CRGB leds[matrixWidth * matrixHeight]; | ||
+ | |||
+ | const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz) | ||
+ | unsigned int sample; | ||
+ | |||
+ | class Matrix { | ||
+ | CRGB *leds = NULL; | ||
+ | uint8_t numLeds = 0; | ||
+ | uint8_t currBrightness = 0; | ||
+ | |||
+ | public: | ||
+ | Matrix(CRGB *initLeds, uint8_t initNum) { | ||
+ | leds = initLeds; | ||
+ | numLeds = initNum; | ||
+ | } | ||
+ | |||
+ | // fill all matrix with same color | ||
+ | void fill(CRGB color) { | ||
+ | for (int i = 0; i < 64; i++) { | ||
+ | leds[i] = color; | ||
+ | } | ||
+ | }; | ||
+ | // fill a binary shape with same color | ||
+ | // { | ||
+ | // B00000000, | ||
+ | // B10101010, | ||
+ | // B00000000, | ||
+ | // B10101010, | ||
+ | // B00000000, | ||
+ | // B10101010, | ||
+ | // B00000000, | ||
+ | // B10101010 | ||
+ | // }; | ||
+ | void fill(CRGB color, byte *shape) { | ||
+ | for (int i = 0; i < matrixHeight; | ||
+ | for (int j = 0; j < matrixWidth; | ||
+ | if (shape[i] & 1 << j) { // if bitwise AND resolves to | ||
+ | leds[i * matrixHeight + j] = color; // send 1 | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | // fill color shape | ||
+ | void fill(CRGB color_shape[][8]) { | ||
+ | for (int i = 0; i < matrixHeight; | ||
+ | for (int j = 0; j < matrixWidth; | ||
+ | leds[i * matrixHeight + j] = color_shape[i][j]; | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | // fill row with color | ||
+ | void fill_y(CRGB color, int row) { | ||
+ | for (int j = 0; j < matrixWidth; | ||
+ | leds[row * matrixHeight + j] = color; // send 1 | ||
+ | } | ||
+ | }; | ||
+ | void fill_y_until(CRGB color_shape[][8], | ||
+ | for (int i = 0; i < until; i++) { | ||
+ | for (int j = 0; j < matrixWidth; | ||
+ | leds[i * matrixHeight + j] = color_shape[i][j]; | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | // fille column with color | ||
+ | void fill_x(CRGB color, int column) { | ||
+ | for (int i = 0; i < matrixHeight; | ||
+ | leds[i * matrixHeight + column] = color; // send 1 | ||
+ | } | ||
+ | }; | ||
+ | void fill_x_until(CRGB color_shape[][8], | ||
+ | for (int i = 0; i < matrixHeight; | ||
+ | for (int j = 0; j < until; j++) { | ||
+ | leds[i * matrixHeight + j] = color_shape[i][j]; | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | // of array in matrix | ||
+ | int sound_scale(); | ||
+ | void color_scale(int sl); // return color for 10 levels of sound intensity | ||
+ | }; | ||
+ | |||
+ | Matrix *mym; | ||
+ | |||
+ | byte sshape[8] = {B00000000, B10101010, B00000000, B10101010, | ||
+ | B00000000, B10101010, B00000000, B10101010}; | ||
+ | |||
+ | CRGB matrix[8][8] = { | ||
+ | {maplv2, maplv2, negro, negro, negro, negro, negro, negro}, | ||
+ | {maplv3, maplv3, maplv3, negro, negro, negro, negro, negro}, | ||
+ | {maplv4, maplv4, maplv4, maplv4, negro, negro, negro, negro}, | ||
+ | {maplv5, maplv5, maplv5, maplv5, maplv5, negro, negro, negro}, | ||
+ | {maplv6, maplv6, maplv6, maplv6, maplv6, maplv6, negro, negro}, | ||
+ | {maplv7, maplv7, maplv7, maplv7, maplv7, maplv7, maplv7, negro}, | ||
+ | {maplv8, maplv8, maplv8, maplv8, maplv8, maplv8, maplv8, maplv8}, | ||
+ | {maplv9, maplv9, maplv9, maplv9, maplv9, maplv9, maplv9, maplv9}, | ||
+ | }; | ||
+ | |||
+ | unsigned int sample_sound() { | ||
+ | unsigned long startMillis = millis(); // Start of sample window | ||
+ | unsigned int peakToPeak = 0; | ||
+ | |||
+ | unsigned int signalMax = 0; | ||
+ | unsigned int signalMin = 1024; | ||
+ | |||
+ | // collect data for 50 mS | ||
+ | while (millis() - startMillis < sampleWindow) { | ||
+ | sample = analogRead(0); | ||
+ | if (sample < 1024) { | ||
+ | if (sample > signalMax) { | ||
+ | signalMax = sample; | ||
+ | } else if (sample < signalMin) { | ||
+ | signalMin = sample; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | peakToPeak = signalMax - signalMin; | ||
+ | |||
+ | return peakToPeak; | ||
+ | } | ||
+ | |||
+ | void setup() { | ||
+ | Serial.begin(115200); | ||
+ | LEDS.addLeds< | ||
+ | mym = new Matrix(leds, | ||
+ | FastLED.setBrightness(BRIGHTNESS); | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | int sample = sample_sound(); | ||
+ | // tomado de https:// | ||
+ | int logmaplv = log(sample + 1) / log(900) * 9; | ||
+ | Serial.println(logmaplv); | ||
+ | |||
+ | for (int i = 0; i <= logmaplv; i++) { | ||
+ | mym-> | ||
+ | FastLED.show(); | ||
+ | FastLED.delay(30); | ||
+ | } | ||
+ | |||
+ | FastLED.clear(); | ||
+ | } | ||
+ | </ | ||
+ | ==== Diagrama electronico ===== | ||
+ | |||
+ | {{: | ||
+ | |||
+ | **Descargar repositorio codigo para programar varios estados en la matriz** | ||
+ | |||
+ | ====== Referentes ====== | ||
+ | |||
+ | * https:// | ||
+ | * https:// | ||
+ | * | ||
+ | |||
+ | ====== Contacto ====== | ||
+ | |||
+ | https:// | ||
- | https:// | ||
proyectos/talleres/ets.txt · Última modificación: 2023/10/03 13:50 por elmago116