La biblioteca Adafruit neopixel
Primero, explicaremos la biblioteca ADAFRUIT NEOPIXEL Esta biblioteca, escrita por Adafruit puede controlar
una serie de LEDs WS2812 por separado. Esto no es útil si quiere crear texto o formas en el panel pero es
ideal si quiere controlar cada LED por separado.
Descargue la biblioteca ADAFRUIT NEOPIXEL:
ZIP)
Ahora, puede instalar esta biblioteca en la instalación Arduino (ponga el fichero descargado en el fichero de la
instalación Arduino). Luego, inicie el software Arduino (Instale también la biblioteca ADAFRUIT NEOPIXEL).
Ahora, haga clic en: File > Examples > Adafruit Neopixel > simple, para que Arduino abrirá este
'sketch'.
La parte superior del fichero que acaba de abrir se visualizará:
// 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__
#include <avr/power.h>
#endif
// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
#define PIN
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS
// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send sig-
nals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strand-
test
// example for more information on possible values.
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
¿Qué pasa aquí?
La primera parte sólo trata de cómo incluir la biblioteca Adafruit.
Luego, #define PIN 6 explica al programa que PIN es igual a 6 y que la corriente de datos viene del pin 6 de la
Arduino. Por ello, si quiere cambiar esto a 13, deberá cambiar este código de línea a: #define PIN 13
Luego, tenemos la línea #define NUMPIXELS 16 que explica al programa cuántos LEDs van a ser controlados.
Para controlar 1 panel, esta línea debería parecerse a: #define NUMPIXELS 64. Si tiene 2 paneles, ponga 128.
En caso de utilizar 3 paneles ponga 192, etc.
MANUAL DEL USUARIO
K8403
https://github.com/adafruit/Adafruit_NeoPixel
6
16
(pulse Download
9