Velleman MATRIZ DE 64 LEDs RGB Manual Del Usuario página 12

Tabla de contenido

Publicidad

for(int i=0;i<NUMPIXELS;i++){
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(i, pixels.Color(0,0,255)); // Brigh blue color.
pixels.show(); // This sends the updated pixel color to the hardware.
delay(delayval); // Delay for a period of time (in milliseconds).
}
for(int i=0;i<NUMPIXELS;i++){
pixels.setPixelColor(i, pixels.Color(0,0,0)); // No color (dark).
}
pixels.show(); //Updating the panel to show nothing.
}
Este código borrará todos los errores después de la función 'for-loop' inicial utilizando una segunda función 'for-
loop'. También hemos cambiado el color a azul (completamente saturado).
Esto es un color muy luminoso. Para cambiar la luminosidad del panel entero, puede utilizar: pixels.
setBrightness(20);Esta función aceptará un valor entre 20 y 255 (0 = luminosidad mín., 255 = luminosidad
máx.). Puede ver cómo esto afectará la pantalla cuando cambie la función 'loop' (haga clic dos veces para
seleccionar y copiar):
void loop() {
pixels.setBrightness(20); // Setting the brightness really low.
// For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pix-
els minus one.
for(int i=0;i<NUMPIXELS;i++){
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(i, pixels.Color(0,0,255)); // Bright blue color.
pixels.show(); // This sends the updated pixel color to the hardware.
delay(delayval); // Delay for a period of time (in milliseconds).
}
for(int i=0;i<NUMPIXELS;i++){
pixels.setPixelColor(i, pixels.Color(0,0,0)); // No color (dark).
}
pixels.show(); // Updating the panel to show nothing.
}
A continuación puede ver cómo el código entero se visualiza de momento. Experimente con todo lo que ha
aprendido en este capítulo antes de continuar. Haga clic dos veces para seleccionar y copiar.
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
MANUAL DEL USUARIO
K8403
12

Publicidad

Tabla de contenido
loading

Tabla de contenido