#include // Incluimos la librería de Adafruit #include #ifdef __AVR__ #include // Required for 16 MHz Adafruit Trinket #endif #define NUMPIXELS 12 // ¿Cuántos neopixels? #define PIN 2 // Definir PIN de salida del microcontrolador Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); // Colocamos datos PulseSensorPlayground pulseSensor; int PulseSensorPurplePin = 28; // variable, espacio en la memoria de arduino, numeros enteros int Signal; // holds the incoming raw data. Signal value can range from 0-1024 int Threshold = 514; void setup() { pixels.begin(); // INITIALIZE NeoPixel (REQUIRED) pixels.show(); // Muestra los datos pixels.setBrightness(150); // Máximo 255, fija el brillo Serial.begin(9600); } void loop() { pixels.clear(); Signal = analogRead(PulseSensorPurplePin); // Read the PulseSensor's value. // Assign this value to the "Signal" variable. Serial.println(Signal); // Send the Signal value to Serial Plotter. if(Signal > Threshold){ // Condición, si mi señal esta arriba de "9600", realiza la siguiente acción pixels.rainbow (0,1,150,100); // Led, divide, Max 255, intensidad del color pixels.show(); } else { pixels.clear(); // Else, the sigal must be below "9600", so "turn-off" this LED. pixels.rainbow (0,0,0,0); } delay(10); }