• Stars
    star
    2,862
  • Rank 15,863 (Top 0.4 %)
  • Language
    C++
  • License
    GNU Lesser Genera...
  • Created almost 12 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Arduino library for controlling single-wire LED pixels (NeoPixel, WS2812, etc.)

Adafruit NeoPixel Library Build StatusDocumentation

Arduino library for controlling single-wire-based LED pixels and strip such as the Adafruit 60 LED/meter Digital LED strip, the Adafruit FLORA RGB Smart Pixel, the Adafruit Breadboard-friendly RGB Smart Pixel, the Adafruit NeoPixel Stick, and the Adafruit NeoPixel Shield.

After downloading, rename folder to 'Adafruit_NeoPixel' and install in Arduino Libraries folder. Restart Arduino IDE, then open File->Sketchbook->Library->Adafruit_NeoPixel->strandtest sketch.

Compatibility notes: Port A is not supported on any AVR processors at this time


Installation

First Method

image

  1. In the Arduino IDE, navigate to Sketch > Include Library > Manage Libraries
  2. Then the Library Manager will open and you will find a list of libraries that are already installed or ready for installation.
  3. Then search for Neopixel strip using the search bar.
  4. Click on the text area and then select the specific version and install it.

Second Method

  1. Navigate to the Releases page.
  2. Download the latest release.
  3. Extract the zip file
  4. In the Arduino IDE, navigate to Sketch > Include Library > Add .ZIP Library

Features

  • Simple to use

    Controlling NeoPixels โ€œfrom scratchโ€ is quite a challenge, so we provide a library letting you focus on the fun and interesting bits.

  • Give back

    The library is free; you donโ€™t have to pay for anything. Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

  • Supported Chipsets

    We have included code for the following chips - sometimes these break for exciting reasons that we can't control in which case please open an issue!

    • AVR ATmega and ATtiny (any 8-bit) - 8 MHz, 12 MHz and 16 MHz
    • Teensy 3.x and LC
    • Arduino Due
    • Arduino 101
    • ATSAMD21 (Arduino Zero/M0 and other SAMD21 boards) @ 48 MHz
    • ATSAMD51 @ 120 MHz
    • Adafruit STM32 Feather @ 120 MHz
    • ESP8266 any speed
    • ESP32 any speed
    • Nordic nRF52 (Adafruit Feather nRF52), nRF51 (micro:bit)
    • Infineon XMC1100 BootKit @ 32 MHz
    • Infineon XMC1100 2Go @ 32 MHz
    • Infineon XMC1300 BootKit @ 32 MHz
    • Infineon XMC4700 RelaxKit, XMC4800 RelaxKit, XMC4800 IoT Amazon FreeRTOS Kit @ 144 MHz

    Check forks for other architectures not listed here!

  • GNU Lesser General Public License

    Adafruit_NeoPixel is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Functions

  • begin()
  • updateLength()
  • updateType()
  • show()
  • delay_ns()
  • setPin()
  • setPixelColor()
  • fill()
  • ColorHSV()
  • getPixelColor()
  • setBrightness()
  • getBrightness()
  • clear()
  • gamma32()

Examples

There are many examples implemented in this library. One of the examples is below. You can find other examples here

Simple

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif
#define PIN        6
#define NUMPIXELS 16

Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
#define DELAYVAL 500

void setup() {
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif

  pixels.begin();
}

void loop() {
  pixels.clear();

  for(int i=0; i<NUMPIXELS; i++) {

    pixels.setPixelColor(i, pixels.Color(0, 150, 0));
    pixels.show();
    delay(DELAYVAL);
  }
}

Contributing

If you want to contribute to this project:

  • Report bugs and errors
  • Ask for enhancements
  • Create issues and pull requests
  • Tell others about this library
  • Contribute new protocols

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Roadmap

The PRIME DIRECTIVE is to maintain backward compatibility with existing Arduino sketches -- many are hosted elsewhere and don't track changes here, some are in print and can never be changed!

Please don't reformat code for the sake of reformatting code. The resulting large "visual diff" makes it impossible to untangle actual bug fixes from merely rearranged lines. Also, don't bother with PRs for timing adjustments "to better match the datasheet," because the datasheet isn't really true to begin with.

Things I'd Like To Do But There's No Official Timeline So Please Don't Count On Any Of This Ever Being Canonical:

  • 400 KHz support can be removed, turns out it was never actually necessary; even the earliest NeoPixels can ingest 800 KHz data. Of course the #defines should remain so old sketches still compile, but both can be set to 0 and would have no effect on anything.
  • For the show() function (with all the delicate pixel timing stuff), break out each architecture into separate source files rather than the current unmaintainable tangle of #ifdef statements!
  • Please don't use updateLength() or updateType() in new code. They should not have been implemented this way (use the C++ 'new' operator with the regular constructor instead) and are only sticking around because of the Prime Directive. setPin() is OK for now though, it's a trick we can use to 'recycle' pixel memory across multiple strips.
  • In the M0 and M4 code, use the hardware systick counter for bit timing rather than hand-tweaked NOPs (a temporary kludge at the time because I wasn't reading systick correctly). (As of 1.4.2, systick is used on M4 devices and it appears to be overclock-compatible. Not for M0 yet, which is why this item is still here.)
  • As currently written, brightness scaling is still a "destructive" operation -- pixel values are altered in RAM and the original value as set can't be accurately read back, only approximated, which has been confusing and frustrating to users. It was done this way at the time because NeoPixel timing is strict, AVR microcontrollers (all we had at the time) are limited, and assembly language is hard. All the 32-bit architectures should have no problem handling nondestructive brightness scaling -- calculating each byte immediately before it's sent out the wire, maintaining the original set value in RAM -- the work just hasn't been done. There's a fair chance even the AVR code could manage it with some intense focus. (The DotStar library achieves nondestructive brightness scaling because it doesn't have to manage data timing so carefully...every architecture, even ATtiny, just takes whatever cycles it needs for the multiply/shift operations.)

Credits

This library is written by Phil "Paint Your Dragon" Burgess for Adafruit Industries, with contributions by PJRC, Michael Miller and other members of the open source community.

License

Adafruit_NeoPixel is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Adafruit_NeoPixel is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with NeoPixel. If not, see this

More Repositories

1

Adafruit-GFX-Library

Adafruit GFX graphics core Arduino library, this is the 'core' class that all our other graphics libraries derive from
C
2,111
star
2

DHT-sensor-library

Arduino library for DHT11, DHT22, etc Temperature & Humidity Sensors
C++
1,835
star
3

Fritzing-Library

Adafruit parts, components, breakouts, etc...in Fritzable format!
1,605
star
4

Adafruit_SSD1306

Arduino library for SSD1306 monochrome 128x64 and 128x32 OLEDs
C++
1,587
star
5

Adafruit-Raspberry-Pi-Python-Code

Adafruit library code for Raspberry Pi
1,414
star
6

Adafruit_Python_DHT

Python library to read the DHT series of humidity and temperature sensors on a Raspberry Pi or Beaglebone Black.
C
1,091
star
7

Adafruit-Eagle-Library

Slowly building up a collection of parts we use here ... This file includes some library parts from microbuilder.eu Most of 'em are either Eagle parts that I've changed a little to make them easier to solder, some are 'handmade' and a few are from microbuilder.eu Its released into the Public Domain - that means you can do whatever you want. We'd like it if you kept the author email/url in the part description, just so we can be alerted if there are errors. Enjoy!
1,005
star
8

Adafruit_Learning_System_Guides

Programs and scripts to display "inline" in Adafruit Learning System guides
C
990
star
9

Adafruit_Sensor

Common sensor library
C++
887
star
10

Adafruit-Pi-Finder

Find and set up your brand new Raspberry Pi
JavaScript
844
star
11

Adafruit_CAD_Parts

CAD files for various boards, components and parts
SMT
829
star
12

RTClib

A fork of Jeelab's fantastic RTC Arduino library
C++
760
star
13

Adafruit_CircuitPython_Bundle

A bundle of useful CircuitPython libraries ready to use from the filesystem.
Shell
737
star
14

awesome-circuitpython

A curated list of awesome CircuitPython guides, videos, libraries, frameworks, software and resources.
620
star
15

Adafruit_nRF52_Arduino

Adafruit code for the Nordic nRF52 BLE SoC on Arduino
C
608
star
16

Adafruit_MQTT_Library

Arduino library for MQTT support
C++
541
star
17

Adafruit_Python_SSD1306

Python library to use SSD1306-based 128x64 or 128x32 pixel OLED displays with a Raspberry Pi or Beaglebone Black.
Python
519
star
18

Adafruit-ST7735-Library

This is a library for the Adafruit 1.8" SPI display http://www.adafruit.com/products/358 and http://www.adafruit.com/products/618
C++
495
star
19

Adafruit_TinyUSB_Arduino

Arduino library for TinyUSB
C
483
star
20

Adafruit-WebIDE

This is a simple editor to be used on the Raspberry Pi (or anywhere?).
JavaScript
474
star
21

adafruit-beaglebone-io-python

Adafruit's BeagleBone IO Python Library
C
465
star
22

Adafruit_GPS

An interrupt-based GPS Arduino library for no-parsing-required use
C++
450
star
23

pi_video_looper

Application to turn your Raspberry Pi into a dedicated looping video playback device, good for art installations, information displays, or just playing cat videos all day.
Python
442
star
24

Adafruit_nRF52_Bootloader

USB-enabled bootloaders for the nRF52 BLE SoC chips
C
437
star
25

Adafruit-PWM-Servo-Driver-Library

Adafruit PWM Servo Driver Library
C++
436
star
26

Adafruit-PN532

Arduino library for SPI and I2C access to the PN532 RFID/Near Field Communication chip
C++
397
star
27

Adafruit_Python_GPIO

DEPRECATED! Please use Adafruit Blinka instead (was: Library to provide a cross-platform GPIO interface on the Raspberry Pi and Beaglebone Black using the RPi.GPIO and Adafruit_BBIO libraries.)
Python
393
star
28

Adafruit_Python_BluefruitLE

Python library to simplify access to Bluetooth low energy devices and services on Linux (using bluez) and Mac OSX.
Python
390
star
29

Adafruit-PCD8544-Nokia-5110-LCD-library

Arduino driver for PC8544, most commonly found in small Nokia 5110's
C++
385
star
30

Adafruit_Blinka

Add CircuitPython hardware API and libraries to MicroPython & CPython devices
Python
384
star
31

Adafruit_CircuitPython_HID

USB Human Interface Device drivers.
Python
374
star
32

Adafruit-Fingerprint-Sensor-Library

Arduino library for interfacing to the fingerprint sensor in the Adafruit shop
C++
364
star
33

Adafruit_ILI9341

Library for Adafruit ILI9341 displays
C++
357
star
34

Adafruit-Retrogame

Raspberry Pi GPIO-to-virtual-keyboard utility for classic game emulators
C
348
star
35

Raspberry-Pi-Installer-Scripts

Shell
348
star
36

Adafruit-Motor-Shield-library

Adafruit Motor shield V1 firmware with basic Microstepping support. Works with all Arduinos and the Mega
C++
329
star
37

Adafruit-MCP23017-Arduino-Library

Arduino Library for Adafruit MCP23017
C++
322
star
38

Adafruit_BME280_Library

Arduino Library for BME280 sensors
C++
312
star
39

Adafruit_BNO055

Unified sensor driver for the Adafruit BNO055 orientation sensor breakout
C++
308
star
40

TFTLCD-Library

Arduino library for 8-bit TFT LCDs such as ILI9325, ILI9328, etc
C
301
star
41

Adafruit-Thermal-Printer-Library

Arduino Library for Small Thermal Printers
C++
300
star
42

Reference-Cards

Business card-sized references for Arduino and basic electronics
294
star
43

Adafruit_LED_Backpack

Adafruit LED Backpack Library for our various LED backpacks.
C++
286
star
44

Adafruit_CircuitPython_NeoPixel

CircuitPython drivers for neopixels.
Python
277
star
45

RGB-matrix-Panel

Arduino library and example code for the 16x32 RGB matrix panels in the shop
C++
275
star
46

Adafruit_CC3000_Library

Library code for Adafruit's CC3000 WiFi breakouts &c
C++
270
star
47

Adafruit_ADS1X15

Driver for TI's ADS1015: 12-bit Differential or Single-Ended ADC with PGA and Comparator
C++
268
star
48

Adafruit_Python_PCA9685

Python code to use the PCA9685 PWM servo/LED controller with a Raspberry Pi or BeagleBone black.
Python
258
star
49

Adafruit_TouchScreen

Arduino library for 4-wire resistive touchscreens
C++
251
star
50

Adafruit_CircuitPython_SSD1306

Adafruit CircuitPython framebuf driver for SSD1306 or SSD1305 OLED displays. Not for use with displayio. See README.
Python
249
star
51

Adafruit_BMP280_Library

Arduino Library for BMP280 sensors
C++
230
star
52

Adafruit-BMP085-Library

A powerful but easy to use BMP085/BMP180 Arduino library
C++
223
star
53

Adafruit_SleepyDog

Arduino library to use the watchdog timer for system reset and low power sleep.
C++
218
star
54

Python-Thermal-Printer

Python
213
star
55

Adafruit_IO_Python

Adafruit IO Python Client Library
Python
213
star
56

LPD8806

Arduino library for LED strips and pixels using LPD8806 (and probably LPD8803/LPD8809)
C++
210
star
57

Adalight

Processing
210
star
58

Adafruit_Python_CharLCD

Python library for accessing Adafruit character LCDs from a Raspberry Pi or BeagleBone Black.
Python
208
star
59

Adafruit_FONA

Arduino library for the Adafruit FONA
C++
206
star
60

Adafruit_BusIO

Arduino library for I2C & SPI abstractions
C++
206
star
61

Adafruit-Trinket-USB

Arduino libraries allowing Trinket to act as USB devices
C
205
star
62

Bluefruit_LE_Connect

iOS app for use with Bluefruit Bluetooth LE breakout board
Swift
203
star
63

Adafruit_Floppy

C++
199
star
64

TinyWireM

I2C library for Trinket and Gemma, adapted from BroHogan's code on Arduino Playground
C++
196
star
65

Adafruit_BluefruitLE_nRF51

Arduino library for nRF51822-based Adafruit Bluefruit LE modules
C++
190
star
66

Adafruit_IO_Arduino

Arduino library to access Adafruit IO from WiFi, cellular, and ethernet modules.
C++
188
star
67

Adafruit-WS2801-Library

Arduino library for controlling strips/pixels using WS2801 driver chips
C++
185
star
68

Adafruit_INA219

INA219 Current Sensor
C++
181
star
69

Adafruit_AHRS

Arduino library for AHRS (Attitude and Heading Reference System) for Adafruit motion sensors
C++
175
star
70

Adafruit_Motor_Shield_V2_Library

Arduino library for Adafruit Motor Shield v2!
C++
171
star
71

AccelStepper

A small fork of AccelStepper v1.3 with AF_motor (Adafruit motor shield) support!
C++
167
star
72

Adafruit_NeoMatrix

Adafruit_GFX-compatible library for NeoPixel grids
C++
167
star
73

SD

fixes & updates to the Arduino SD library - totally in progress. works but in beta
C++
166
star
74

Adafruit_ESP8266

Example code for ESP8266 chipset
C++
165
star
75

RadioHead

A github'ified version of http://www.airspayce.com/mikem/arduino/RadioHead/
C++
164
star
76

Adafruit_CircuitPlayground

library for Circuit Playground board
C++
159
star
77

Raw-IR-decoder-for-Arduino

Take raw IR signal from a remote receiver and print out pulse lengths
C++
158
star
78

circuitpython-org

CircuitPython's website
HTML
153
star
79

Bluefruit_LE_Connect_v2

iOS app for use with Bluefruit Bluetooth LE modules and dev boards from Adafruit (v2.0)
Swift
152
star
80

MAX6675-library

Arduino library for interfacing with MAX6675 thermocouple amplifier
C++
136
star
81

CircuitPython_Community_Bundle

A bundle of useful CircuitPython libraries from the CircuitPython community.
Shell
134
star
82

Adafruit_TCS34725

Arduino library driver for Adafruit's TCS34725 RGB Color Sensor Breakout
C++
133
star
83

Adafruit-VC0706-Serial-Camera-Library

Library for VC0706-based Serial JPEG Cameras
C++
132
star
84

adafruit-bluefruit-le-desktop

Desktop application to interact with Bluefruit LE and other Bluetooth low energy devices on Mac OSX, Windows, and Linux.
JavaScript
131
star
85

Adafruit_VL53L0X

Arduino library for Adafruit VL53L0X
C++
131
star
86

Adafruit_NFCShield_I2C

I2C Driver for Adafruit's PN532-based NFC Shield
C++
128
star
87

awesome-feather

A curated list of awesome Feather form factor boards, guides, videos, libraries, software and resources.
127
star
88

Adafruit_CircuitPython_ADS1x15

CircuitPython drivers for the ADS1x15 series of ADCs.
Python
127
star
89

Adafruit_CircuitPython_BLE

Bluetooth Low Energy (BLE) library for CircuitPython
Python
126
star
90

circup

CircuitPython library updater.
Python
124
star
91

Adafruit_SPIFlash

Arduino library for external (Q)SPI flash device
C++
124
star
92

Adafruit_VS1053_Library

This is a Arduino library for the Adafruit VS1053 Codec Breakout and Music Maker Shields
C++
124
star
93

FreqShow

Raspberry Pi & PiTFT-based RTL-SDR frequency scanning and display tool.
Python
123
star
94

Adafruit_Adalink

Python wrapper for Segger's J-Link Commander & STMicro STLink V2 to flash various ARM MCUs
Python
122
star
95

FifteenStep

A general purpose Arduino MIDI sequencer library
C++
121
star
96

TV-B-Gone-kit

*Pew* *Pew* TV's are toast!
C
120
star
97

Adafruit-MLX90614-Library

Arduino library for the MLX90614 sensors in the Adafruit shop
C++
117
star
98

Bluefruit_LE_Connect_Android

Android port of Adafruit's Bluefruit LE Connect app
Java
117
star
99

Adafruit_Python_BME280

Python Driver for the Adafruit BME280 Breakout
Python
116
star
100

Adafruit_Python_ADS1x15

Python code to use the ADS1015 and ADS1115 analog to digital converters with a Raspberry Pi or BeagleBone black.
Python
114
star