GithubHelp home page GithubHelp logo

adafruit / adafruit_neopixel Goto Github PK

View Code? Open in Web Editor NEW
3.0K 217.0 1.2K 881 KB

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

License: GNU Lesser General Public License v3.0

C++ 91.55% C 8.45%
arduino-library

adafruit_neopixel's Introduction

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

adafruit_neopixel's People

Contributors

adescobar avatar aikume avatar bodmer avatar dhalbert avatar dimitre avatar evaherrada avatar gschandler avatar hasenradball avatar hathach avatar henrygab avatar hierophect avatar jamesfowkes avatar jjinno avatar jrcutler avatar kurte avatar ladyada avatar linobarreca avatar mikeshub avatar mxgxw avatar olaffilies avatar paintyourdragon avatar patlkli avatar paulstoffregen avatar per1234 avatar sfranzyshen avatar siddacious avatar tdicola avatar tobiasebsen avatar toddtreece avatar tyeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_neopixel's Issues

RGBWstrandtest on M0: 'int gamma []' redeclared as different kind of symbol

Hi, I was just testing out some NeoPixels on a Feather M0 Wifi, and most of the examples work fine, but the RGBWstrandtest one won't compile, it gives me the error below. I think the gamma variable just needs to be renamed.

Arduino: 1.6.8 (Mac OS X), Board: "Adafruit Feather M0 (Native USB Port)"

/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware "/Applications/Arduino.app/Contents/Java/hardware" -hardware "/Users/nfriedly/Library/Arduino15/packages" -tools "/Applications/Arduino.app/Contents/Java/tools-builder" -tools "/Applications/Arduino.app/Contents/Java/hardware/tools/avr" -tools "/Users/nfriedly/Library/Arduino15/packages" -built-in-libraries "/Applications/Arduino.app/Contents/Java/libraries" -libraries "/Users/nfriedly/Documents/Arduino/libraries" -fqbn=adafruit:samd:adafruit_feather_m0 -vid-pid=0X239A_0X800B -ide-version=10608 -build-path "/var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/build857b94d737fe9db5678f559559373094.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "/var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/arduino_modified_sketch_625224/RGBWstrandtest.ino"
/Applications/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware "/Applications/Arduino.app/Contents/Java/hardware" -hardware "/Users/nfriedly/Library/Arduino15/packages" -tools "/Applications/Arduino.app/Contents/Java/tools-builder" -tools "/Applications/Arduino.app/Contents/Java/hardware/tools/avr" -tools "/Users/nfriedly/Library/Arduino15/packages" -built-in-libraries "/Applications/Arduino.app/Contents/Java/libraries" -libraries "/Users/nfriedly/Documents/Arduino/libraries" -fqbn=adafruit:samd:adafruit_feather_m0 -vid-pid=0X239A_0X800B -ide-version=10608 -build-path "/var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/build857b94d737fe9db5678f559559373094.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "/var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/arduino_modified_sketch_625224/RGBWstrandtest.ino"
"/Users/nfriedly/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++"  -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions  -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10608 -DARDUINO_SAMD_FEATHER_M0 -DARDUINO_ARCH_SAMD  -DARDUINO_SAMD_ZERO -D__SAMD21G18A__ -DUSB_VID=0x239A -DUSB_PID=0x800B -DUSBCON '-DUSB_MANUFACTURER="Adafruit"' '-DUSB_PRODUCT="Feather M0"'     "-I/Users/nfriedly/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" "-I/Users/nfriedly/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/"  "-I/Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/cores/arduino" "-I/Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/variants/arduino_zero" "/var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/build857b94d737fe9db5678f559559373094.tmp/sketch/RGBWstrandtest.ino.cpp" -o "/dev/null"
"/Users/nfriedly/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++"  -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions  -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10608 -DARDUINO_SAMD_FEATHER_M0 -DARDUINO_ARCH_SAMD  -DARDUINO_SAMD_ZERO -D__SAMD21G18A__ -DUSB_VID=0x239A -DUSB_PID=0x800B -DUSBCON '-DUSB_MANUFACTURER="Adafruit"' '-DUSB_PRODUCT="Feather M0"'     "-I/Users/nfriedly/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" "-I/Users/nfriedly/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/"  "-I/Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/cores/arduino" "-I/Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/variants/arduino_zero" "-I/Users/nfriedly/Documents/Arduino/libraries/Adafruit_NeoPixel" "/var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/build857b94d737fe9db5678f559559373094.tmp/sketch/RGBWstrandtest.ino.cpp" -o "/dev/null"
"/Users/nfriedly/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++"  -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions  -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10608 -DARDUINO_SAMD_FEATHER_M0 -DARDUINO_ARCH_SAMD  -DARDUINO_SAMD_ZERO -D__SAMD21G18A__ -DUSB_VID=0x239A -DUSB_PID=0x800B -DUSBCON '-DUSB_MANUFACTURER="Adafruit"' '-DUSB_PRODUCT="Feather M0"'     "-I/Users/nfriedly/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" "-I/Users/nfriedly/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/"  "-I/Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/cores/arduino" "-I/Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/variants/arduino_zero" "-I/Users/nfriedly/Documents/Arduino/libraries/Adafruit_NeoPixel" "/Users/nfriedly/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp" -o "/dev/null"
"/Users/nfriedly/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++"  -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions  -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10608 -DARDUINO_SAMD_FEATHER_M0 -DARDUINO_ARCH_SAMD  -DARDUINO_SAMD_ZERO -D__SAMD21G18A__ -DUSB_VID=0x239A -DUSB_PID=0x800B -DUSBCON '-DUSB_MANUFACTURER="Adafruit"' '-DUSB_PRODUCT="Feather M0"'     "-I/Users/nfriedly/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" "-I/Users/nfriedly/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/"  "-I/Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/cores/arduino" "-I/Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/variants/arduino_zero" "-I/Users/nfriedly/Documents/Arduino/libraries/Adafruit_NeoPixel" "/Users/nfriedly/Documents/Arduino/libraries/Adafruit_NeoPixel/esp8266.c" -o "/dev/null"
"/Users/nfriedly/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++"  -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions  -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10608 -DARDUINO_SAMD_FEATHER_M0 -DARDUINO_ARCH_SAMD  -DARDUINO_SAMD_ZERO -D__SAMD21G18A__ -DUSB_VID=0x239A -DUSB_PID=0x800B -DUSBCON '-DUSB_MANUFACTURER="Adafruit"' '-DUSB_PRODUCT="Feather M0"'     "-I/Users/nfriedly/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" "-I/Users/nfriedly/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/"  "-I/Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/cores/arduino" "-I/Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/variants/arduino_zero" "-I/Users/nfriedly/Documents/Arduino/libraries/Adafruit_NeoPixel" "/var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/build857b94d737fe9db5678f559559373094.tmp/sketch/RGBWstrandtest.ino.cpp" -o "/dev/null"
"/Users/nfriedly/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++"  -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions  -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10608 -DARDUINO_SAMD_FEATHER_M0 -DARDUINO_ARCH_SAMD  -DARDUINO_SAMD_ZERO -D__SAMD21G18A__ -DUSB_VID=0x239A -DUSB_PID=0x800B -DUSBCON '-DUSB_MANUFACTURER="Adafruit"' '-DUSB_PRODUCT="Feather M0"'     "-I/Users/nfriedly/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" "-I/Users/nfriedly/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/"  "-I/Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/cores/arduino" "-I/Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/variants/arduino_zero" "-I/Users/nfriedly/Documents/Arduino/libraries/Adafruit_NeoPixel" "/var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/build857b94d737fe9db5678f559559373094.tmp/sketch/RGBWstrandtest.ino.cpp" -o "/var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/build857b94d737fe9db5678f559559373094.tmp/preproc/ctags_target_for_gcc_minus_e.cpp"
"/Applications/Arduino.app/Contents/Java/tools-builder/ctags/5.8-arduino10/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/build857b94d737fe9db5678f559559373094.tmp/preproc/ctags_target_for_gcc_minus_e.cpp"
"/Users/nfriedly/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -DF_CPU=48000000L -DARDUINO=10608 -DARDUINO_SAMD_FEATHER_M0 -DARDUINO_ARCH_SAMD  -DARDUINO_SAMD_ZERO -D__SAMD21G18A__ -DUSB_VID=0x239A -DUSB_PID=0x800B -DUSBCON '-DUSB_MANUFACTURER="Adafruit"' '-DUSB_PRODUCT="Feather M0"' "-I/Users/nfriedly/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" "-I/Users/nfriedly/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/" "-I/Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/cores/arduino" "-I/Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/variants/arduino_zero" "-I/Users/nfriedly/Documents/Arduino/libraries/Adafruit_NeoPixel" "/var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/build857b94d737fe9db5678f559559373094.tmp/sketch/RGBWstrandtest.ino.cpp" -o "/var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/build857b94d737fe9db5678f559559373094.tmp/sketch/RGBWstrandtest.ino.cpp.o"
RGBWstrandtest:14: error: 'int gamma []' redeclared as different kind of symbol
 int gamma[] = {
           ^
In file included from /Users/nfriedly/Library/Arduino15/packages/adafruit/hardware/samd/1.0.8/cores/arduino/Arduino.h:27:0,
                 from /var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/build857b94d737fe9db5678f559559373094.tmp/sketch/RGBWstrandtest.ino.cpp:1:
/Users/nfriedly/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/arm-none-eabi/include/math.h:296:15: error: previous declaration of 'double gamma(double)'
 extern double gamma _PARAMS((double));
               ^
/var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/arduino_modified_sketch_625224/RGBWstrandtest.ino: In function 'void pulseWhite(uint8_t)':
RGBWstrandtest:76: error: invalid conversion from 'double (*)(double)' to 'uint8_t {aka unsigned char}' [-fpermissive]
           strip.setPixelColor(i, strip.Color(0,0,0, gamma[j] ) );
                                                            ^
In file included from /var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/arduino_modified_sketch_625224/RGBWstrandtest.ino:1:0:
/Users/nfriedly/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.h:143:5: error:   initializing argument 4 of 'static uint32_t Adafruit_NeoPixel::Color(uint8_t, uint8_t, uint8_t, uint8_t)' [-fpermissive]
     Color(uint8_t r, uint8_t g, uint8_t b, uint8_t w);
     ^
RGBWstrandtest:84: error: invalid conversion from 'double (*)(double)' to 'uint8_t {aka unsigned char}' [-fpermissive]
           strip.setPixelColor(i, strip.Color(0,0,0, gamma[j] ) );
                                                            ^
In file included from /var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/arduino_modified_sketch_625224/RGBWstrandtest.ino:1:0:
/Users/nfriedly/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.h:143:5: error:   initializing argument 4 of 'static uint32_t Adafruit_NeoPixel::Color(uint8_t, uint8_t, uint8_t, uint8_t)' [-fpermissive]
     Color(uint8_t r, uint8_t g, uint8_t b, uint8_t w);
     ^
/var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/arduino_modified_sketch_625224/RGBWstrandtest.ino: In function 'void rainbowFade2White(uint8_t, int, int)':
RGBWstrandtest:140: error: invalid conversion from 'double (*)(double)' to 'uint8_t {aka unsigned char}' [-fpermissive]
             strip.setPixelColor(i, strip.Color(0,0,0, gamma[j] ) );
                                                              ^
In file included from /var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/arduino_modified_sketch_625224/RGBWstrandtest.ino:1:0:
/Users/nfriedly/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.h:143:5: error:   initializing argument 4 of 'static uint32_t Adafruit_NeoPixel::Color(uint8_t, uint8_t, uint8_t, uint8_t)' [-fpermissive]
     Color(uint8_t r, uint8_t g, uint8_t b, uint8_t w);
     ^
RGBWstrandtest:149: error: invalid conversion from 'double (*)(double)' to 'uint8_t {aka unsigned char}' [-fpermissive]
             strip.setPixelColor(i, strip.Color(0,0,0, gamma[j] ) );
                                                              ^
In file included from /var/folders/95/_6btw8d94sq2b91k8j794zpm0000gn/T/arduino_modified_sketch_625224/RGBWstrandtest.ino:1:0:
/Users/nfriedly/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.h:143:5: error:   initializing argument 4 of 'static uint32_t Adafruit_NeoPixel::Color(uint8_t, uint8_t, uint8_t, uint8_t)' [-fpermissive]
     Color(uint8_t r, uint8_t g, uint8_t b, uint8_t w);
     ^
Using library Adafruit_NeoPixel at version 1.0.5 in folder: /Users/nfriedly/Documents/Arduino/libraries/Adafruit_NeoPixel 
exit status 1
'int gamma []' redeclared as different kind of symbol

Some bugs in the color & brightness related code

Hi there !
Currently using the library for a Led Ring.
The code used to manage the pixels color and brightness is very buggy : we can't setBrightness lots of times in a row without re-calling setPixelColor each time.

For example here I create a rainbow. Then, I create a "breath" with lots of calls to setBrightness().
You can see that after a few setBrightness cycles, most of the leds are off.
That's probably related to the re-scale code used here :

    if(oldBrightness == 0) scale = 0; // Avoid /0
    else if(b == 255) scale = 65535 / oldBrightness;
    else scale = (((uint16_t)newBrightness << 8) - 1) / oldBrightness;
    for(uint16_t i=0; i<numBytes; i++) {
      c      = *ptr;
      *ptr++ = (c * scale) >> 8;
    }

img_20150718_211913

Why don't you store the brightness somewhere without touching the original color values (that is buggy), and do some multiplication in show() ?

Salamandar

esp8266 header updates

Some of the default headers included in the latest ESP8266 Arduino project have changed. esp8266.c needs to include eagle_soc.h so that GPIO_REG_WRITE can resolve.

Issues with long strings past 255 pixels

I am still going through the code but I am seeing some odd behavior when going past 255 neopixles (not an issue with the power supply). Currently running on a Uno which has no memory problems up to 550 pixels with all the code I have thrown at it so far.

When I try to go past 255 pixles (256 and higher) the strip animation switches direction (ends) and does some strange things such as leaving LEDs on or having gaps in the strip.

I figure there must be an unsigned 8-bit integer that I am overrunning in the code somewhere since 255 is the magic number I am having trouble with.

CRC Doesn't Match (Arduino Library Manager)

Hi,

Arduino 1.6.8, OS X 10.11.4.

When trying to install via Arduino Library Manager (either clicking update or selecting 1.0.5 + install), it fails. Stack trace:

CRC doesn't match. File is corrupted.
java.lang.RuntimeException: java.lang.Exception: CRC doesn't match. File is corrupted.
    at cc.arduino.contributions.libraries.ui.LibraryManagerUI.lambda$onInstallPressed$12(LibraryManagerUI.java:231)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.Exception: CRC doesn't match. File is corrupted.
    at cc.arduino.contributions.DownloadableContributionsDownloader.download(DownloadableContributionsDownloader.java:77)
    at cc.arduino.contributions.libraries.LibraryInstaller.install(LibraryInstaller.java:97)
    at cc.arduino.contributions.libraries.ui.LibraryManagerUI.lambda$onInstallPressed$12(LibraryManagerUI.java:227)
    ... 1 more

Flickering leds

Hey all,

Anyone know why I would have flickering when the colors transition to red?

I have 60 led strip, using example code. Correct wiring from arduino signal and ground and a separate 5v 30A power supply. When the leds start to transition to red, they start flickering.

I've tried other libraries like polulu and it works just fine, so i figured it was something with code?

Thanks in advance for steering me in the right direction.

Mike

strandtest.ino suggested tweaks

Default code uses Pin 6, if this was Pin 0, it would be better for Trinket and ESP8266-01. Also if a define was put up top adding avr/power.h only for AVR architectures, it would help the novice also.

flashing strip with esp-12

Hi.

using current master i see flashes once and a while (quite often actually) using a neopixel-strip with esp-12.
I use pin-2 to drive the strip, power it directly from a LiPo and use a quite big (620uF) capacitor to stabilize the voltage.
I am using the strandtest example with the latest esp8266 version for Arduino (2.0.0-rc1)

Computer says that master file is invalid

Here's the error message it keeps giving me:

Arduino: 1.6.6 (Mac OS X), Board: "Arduino/Genuino Uno"

/Users/cgoldman/Documents/Arduino/cloud-lightning/cloudlightning_trial1.ino:31:31: fatal error: Adafruit_NeoPixel.h: No such file or directory
#include <Adafruit_NeoPixel.h>
^
compilation terminated.
exit status 1
Error compiling.
Invalid library found in /Users/cgoldman/Documents/Arduino/libraries/Adafruit_NeoPixel-master: /Users/cgoldman/Documents/Arduino/libraries/Adafruit_NeoPixel-master

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

If anyone could help me or at least point me in the direction of someone who could help, I would really appreciate it!!

Doesn't compile on ESP8266: 'GPIO_OUT_W1TS_ADDRESS' undeclared

Arduino 1.6.4 on Huzzah ESP8266, compile produces this error:

/Users/Family/Documents/Arduino/libraries/Adafruit_NeoPixel/esp8266.c: In function 'espShow':
/Users/Family/Documents/Arduino/libraries/Adafruit_NeoPixel/esp8266.c:53:20: error: 'GPIO_OUT_W1TS_ADDRESS' undeclared (first use in this function)
     GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, pinMask);       // Set high
                    ^
/Users/Family/Documents/Arduino/libraries/Adafruit_NeoPixel/esp8266.c:53:20: note: each undeclared identifier is reported only once for each function it appears in
/Users/Family/Documents/Arduino/libraries/Adafruit_NeoPixel/esp8266.c:56:20: error: 'GPIO_OUT_W1TC_ADDRESS' undeclared (first use in this function)
     GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, pinMask);       // Set low
                    ^
Error compiling.

NeoPixelBus compiles fine. Do I need an additional #include for ESP8266?

Library seems to be causing flashing colors in parts of the strip (video provided)

Video: https://www.youtube.com/watch?v=aQaF095z5wg

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: Adafruit Trinket Pro 5V 16MhZ
  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.6.9
  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): Upload 'simple' example

Introduce version number in header

It would be helpful to have a version number in the header so that sketches can detect if the used library version is sufficient ...; something similar to:

#define NEOPIXEL_VER_MAJOR  1
#define NEOPIXEL_VER_MINOR  0
#define NEOPIXEL_VER_MICRO  3
#define NEOPIXEL_VERSION    (NEOPIXEL_VER_MAJOR * 1000000) + (NEOPIXEL_VER_MINOR * 1000) + NEOPIXEL_VER_MICRO

with that we could use in a sketch:

#include <Adafruit_NeoPixel.h>
#if NEOPIXEL_VERSION < 1000003
#error Please upgrade the Neopixel library to at least 1.0.3!
#endif

RGBWstrandtest fails to show up in IDE Examples menu

Hi,

the RGBWstrandtest example does not show up in the Arduino IDE (Debian/stable's ver. 1.0.5) as the directory name does not match the .ino filename within it. Renaming RGBW_strandtest.ino to RGBWstrandtest.ino (or vice versa, renaming the directory to add an underscore) fixes it.

thanks,
Hamish

For Phil.

Hi,

We talked @ pizza meet - my library is here: https://github.com/sonyhome/FAB_LED/wiki

If you're still developing the neopixel library you might want to poach the bitbanging code that is in C to replace the complex AVR ASM code you have in this library.

A thing I was debating on doing in a median term future is to build a shim class that allows code written for the neopixel library to run on top of the FAB_LED library.

cheers.

What happened to getPin()

Looks like "getPin()" has disappeared.

I've personally been using getPin() and would like it back, but if there's been a good reason for getting rid of it, then I guess I can work around it.

Is there a place I can go to here in github, to see code-change comments? Maybe a reason was given, but I can't find it.

Thanks!

Whole strip go OFF when same RGB values in last LED

Hello, i have problem with WS2812 strip.
When i set same RGB values (like 255,255,255, or 121,121,121), in last LED in strip, whole strip is OFF. I can change any color i want, but until i wont change last LED in strip into state, when RGB values are not same, problem remains. So whole strip can have random colors, everything is working, but if last LED is 141,141,141 whole strip is OFF, i change last color to 141,140,141, eveything is working. I was trying this even with more peaces and problem is still the same.

Simple example of code:

#include <Adafruit_NeoPixel.h>
#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(2, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}

void loop(){

... wating until data arrives from serial .....

// This is OK
changeColor(0, 12, 18, 15);
changeColor(1, 25, 25, 24);

// This is OK
changeColor(0, 10, 10, 10); // Here can be even same color
changeColor(1, 25, 25, 24);

// This is NOT OK
changeColor(0, 12, 18, 15);
changeColor(1, 25, 25, 25); // When same color here, not working.

... Other code
}

void changeColor(int n, int r, int g, int b){
strip.setPixelColor(n, r, g, b);
strip.show();
}

Travis CI reports signed being compared to unsigned warnings ( really an error )

They can cause problems. I would fix them by making t,time0, time1 and unsigned int. It doesn't look like they ever should be negative - but I have no way of testing this.

/home/travis/arduino_ide/libraries/Adafruit_Test_Library/Adafruit_NeoPixel.cpp: In member function 'void Adafruit_NeoPixel::show()':
/home/travis/arduino_ide/libraries/Adafruit_Test_Library/Adafruit_NeoPixel.cpp:1078:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(*timeValue < period);
                        ^
/home/travis/arduino_ide/libraries/Adafruit_Test_Library/Adafruit_NeoPixel.cpp:1081:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(*timeValue < t);
                        ^
/home/travis/arduino_ide/libraries/Adafruit_Test_Library/Adafruit_NeoPixel.cpp:1089:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(*timeValue < period); // Wait for last bit

Neopixel library on UDOO

Hello everyone I am trying to use the neopixel library on the UDOO board which has essentially the same chip as the aruduino DUE. IT has been mentioned in the forum that this library should work with the DUE and it has been tested.

I could not manage to drive the neopixels with the library. It compiles fine but it doesnt light the pixels for some reason.

I used the Fastled library (2.1 branch) and it lit the pixels well. So I know it is definitely possible and it works. The only problem witht he fastled library is that when I go to pixels beyond 60, they start to flicker. It gets worse over time.

Could anyone tell me how to get this library to work on the DUE or alternatively the UDOO.

Attinny85

I'm trying to control a strip of a single Neopixel with an Attiny85 @ 16Mhz (internal PLL, 4.3 V BOD) but it just doesn't work. the example "strandtest" just makes the led stuck in green, any help? i'm just connecting the data cable of the neopixel to the Pin 7 (PB2) in the Attiny, i also try putting a resistor in this but it doesn't help.

                 ATTINY85
           ____________
           | RST      VCC | ---- 5v          (330ohms)                  grn----- | GND
           | PB3       PB2 | ---------------------ww------------------------------ | DI             NEOPIXEL
           | PB4       PB1 |                                                         5v----- | 5V

grn----- | GRN PB0 |
____________

define PIN 2

// How many NeoPixels are attached to the Arduino?

define NUMPIXELS 1

Trying to run a hold program with FastSPI_LED2

Hi guys, sorry for this question, maybe is too easy to fix, I have a old program that was made with FastSPI_LED2 but I cant make it run with the new library, what I have to do???

Thanks, Merry Christmas...

Using Adafruit_NeoPixel .cpp and header file on Raspberry Pi

Hi,

Thanks for the work on this! I am working on a project in C on raspberry Pi and I wonder if anyone has ever tested using the .h and .cpp files in this project on Raspberry Pi. To write a script, I could use the wiringPi library Does this sound feasible, and if so do you have any suggestions on how it might be done?

Incompatibility with digispark digiusb

Hi there,
Not sure if here is the good place to mention that...
NeoPixel with digispark runs perfectly but as soon as I include digiusb, just include the file, before or after including neopixel, I can no longer control the NeoPixel.
Thanks

example rgbwstrandtest xtensa conflict

Suggest renaming gamma[] as it conflicts with esp8266 extensa

RGBWstrandtest:17: error: 'int gamma []' redeclared as different kind of symbol

 int gamma[] = {

           ^

In file included from \projects\arduino\sketches\hardware\esp8266com\esp8266\cores\esp8266/Arduino.h:34:0,

                 from sketch\RGBWstrandtest.ino.cpp:1:

esp8266com\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\math.h:296:15: error: previous declaration of 'double gamma(double)'

 extern double gamma _PARAMS((double));

unlock more than 115 leds

How can I use more than 115 leds in WS2811/12 ledstrips?
That's the maximum I can control when using the library.
I really appreciate if anyone can help with some tips on this.
I had the same problem using FastLed library too.
Thanks!

Add support for Galileo

I'm getting some erros trying to compile for galileo , are you planning to support it ? Thanks

typedef for neoPixelType appears wrong with respect to NEO_KHZ400

The code defining the typedef for neoPixelType appears to be the wrong way round with respect to NEO_KHZ400 according to the comment.
The comment suggests that if NEO_KHZ400 is defined, then neoPixelType should be 16 bit, but if it's not, then 8 bit is sufficient. But the code does the opposite...

// If 400 KHz support is enabled, the third parameter to the constructor
// requires a 16-bit value (in order to select 400 vs 800 KHz speed).
// If only 800 KHz is enabled (as is default on ATtiny), an 8-bit value
// is sufficient to encode pixel color order, saving some space.

#ifdef NEO_KHZ400
typedef uint8_t  neoPixelType;
#else
typedef uint16_t neoPixelType;
#endif

refactor color datatypes

There are some PRs for this already i noticed, it would be nice to see color be objects and not uint32 packed.

They can be extended to include brightness channel as well, and makes it at least possible to maybe do non destructive global brightness adjustments or ignore it entirely on a per pixel basis.

Brightness idea

Instead of loosing fidelity by setting the brightness, couldn't brightness be set on the call to show() in a temp var? Maybe this option would be disabled by default and enabled by users who know they have the RAM for it?

add a "name" field

Wondering if it would be a good idea (or not) to add a "name" or "id" field to this class? In my project, I have 2 strips, and it'd be nice to have some kind of member variable to distinguish between them. A "String", or even just a "byte" would be enough.

Thanks for thinking about it,
Mark

esp8266 timing accuracy and problems

There seems to be a timing problem controlling neopixels on esp8266 based boards. Reports on the forum are here: https://forums.adafruit.com/viewtopic.php?f=57&t=103097 https://forums.adafruit.com/viewtopic.php?f=57&t=103844 , and on the MicroPython github: micropython/micropython#2465

There are 2 parts to this issue. First, what is the exact theoretical timing that the WS2812 expects? (The WS2811 probably has similar problems, but let's just concentrate on the WS2812 for now.) I found a datasheet that says:

T0H   = 0.35us +/- 0.15us
T1H   = 0.7us  +/- 0.15us
TH+TL = 1.25us +/- 0.6us

In the code in this repo following values seem to be used (respectively to the values above, all in microseconds):

Atmel 8MHz:  0.25,   0.875,  1.25
Atmel 12MHz: 0.333,  0.833,  1.25
Atmel 16MHz: 0.3125, 0.8125, 1.25
ESP8266:     0.4,    0.8,    1.25

There seems to be a bit of a discrepancy here.

Second part: the actual timing of the esp8266 output (as captured on a scope) is slightly larger than the values listed above, because the loop does timing based on a CPU tick counter but does not take into account overhead from the loop and setting the GPIO registers. The actual values measured are, with esp8266 running at 80MHz:

T0H   between 0.417us and 0.5us
T1H   between 0.833us and 0.875us
TH+TL between 1.250us and 1.33us

Questions and issues are:

  1. What theoretical values for the timing should a neopixel driver aim for to be compatible with the majority of WS2812 devices?
  2. The esp8266 driver needs to be fixed to include the overhead of the loop, likely this is as simple as subtracting a fixed value from time0, time1 and period.

which version of arduino

please state which version of arduino to use. new users or infrequent users would appreciate this.

Licensing mess

Files Adafruit_NeoPixel.cpp and Adafruit_NeoPixel.h mention LGPLv3+ in comment on top of them, but COPYING file mentions GPLv3+.

I suggest to either change the COPYING file or fix the headers.

Losing time in the show() updates

Hi,

The library's show() function runs with interrupts disabled. This is no problem for short strips, but as they get longer and longer, the internal timing will be off due to missed timer interrupts.

On a standard 16MHz Arduino (f.ex. uno or pro mini) you have timer0 to keep time running at a 1.024ms interval. When the strip contains 34 LEDs or more, then the interrupts are disabled for longer than 1.020 ms (8 * 3 * 1.25us * numLEDs, plus some overhead), and the millis() time will lag by a millisecond or more each time an update occurs. For most projects this would not be a problem, but when programming games, it becomes an issue and the interaction timing is thrown off (events come later than expected). Especially since I use strip-lengths of 60...250 LEDs with millisecond game timing and frequent updates.

An obvious solution would be to use multiple small-length strips, but that requires more pins and, more importantly, creates visual artefacts because the LEDs no longer update simultaneously.

A solution, which I have been using, is to compensate the internal timer counter with the lost time just before the interrupts are re-enabled, like in (bottom of show() function):
...
extern volatile unsigned long timer0_millis;
timer0_millis += numLEDs / 34;
interrupts();
...
This hard correction is not perfect, but keeps time much better and keeps the game better within real-time.

There are several problems here. The above correction is non-portable, does not take into account the fractional correction in the timer interrupt and additionally has an awkward division. It works satisfactory for the Arduinos I've been using, but a better thought is required to make it more general and portable. Any better thoughts and possible integration into the code-base would be welcomed.

--
Greetings Bertho

setBrightness

The setBrightness function is very handy (saves power, allows your eyes to stop burning when working, etc.).

I suggest one or more examples shows using this.

Conflict with tone() ?

Something about calling show() seems to interfere with tones played using the tone() function. I have an 8 Ohm speaker wired through a 100 Ohm resistor to pin 53 of my Arduino Mega. Using the code below, the tone plays normally until we enter the loop(), then becomes garbled.

#include <Adafruit_NeoPixel.h>
#define PIN 13

Adafruit_NeoPixel strip = Adafruit_NeoPixel(240, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
  strip.begin();
  tone(53, 440);
  delay(1000);
}

void loop() {
  strip.show();
}

Feature Request: updateLength()

I'm trying (and failing) to make a function that works just like the updateLength() function in the Adafruit_WS2801 library (link below) that allows you to logically change the number of pixels in the strip. I think my attempt to add this failed because while even though all variables from the 2801 library are still present in the NeoPixel Library with the same names, some are now constant but weren't before. Please help :)

If you guys prefer for me to make this feature request in a different place, I can do that, too.

https://github.com/adafruit/Adafruit-WS2801-Library/blob/master/Adafruit_WS2801.cpp

Using delay() is really bad practice...

I recently started to use this library and I'm really disappointed by the examples. They use the delay() function which is really bad practice imo. Because instead of loop+delay you can use static variables and repetitive function calling. That way you would be able to do useful stuff like listening to rotary switches or controlling other LED strips while also doing the same thing as before.

What I'm talking about is that instead of code like this:

uint32_t red = strip.Color(255, 0, 0);

void loop() {
  colorWipe_stupid(red);
}

void colorWipe_stupid(uint32_t color) {
  static uint8_t wait = 50;
  for(uint16_t currentLed=0; currentLed<strip.numPixels(); currentLed++) {
    strip.setPixelColor(currentLed, color);
    strip.show();
    delay(50);
  }
}

you could use code like that:

uint32_t red = strip.Color(255, 0, 0);

void loop() {
  colorWipe_smart(red);
}

void colorWipe_smart(uint32_t color) {
  static uint8_t wait = 50;
  static unsigned long lastUpdate = 0;
  static uint16_t currentLed = 0;

  unsigned long now = millis();
  if (now > lastUpdate+delay) {
    strip.setPixelColor(currentLed, color);
    strip.show();   
    currentLed = currentLed>strip.numPixels() ? 0 : currentLed+1;
    lastUpdate = now;
  }
}

I'd really like to hear what the developers of this library think about that.

nointerrupts problem

Hi,
I know that it is important that the Arduino doesn't get interrupts when setting the LED Strip.
But sometimes it is also important (more important) to get an interrupt instead of setting the LEDs.

Example an IR-Remote.

So my question:
Is it possible to add a function (disableNoInterrupts() for example) to allow interrupts? I know, the LED strip will probably show other colors or will not update for 1 show()-command. But the IR-remote command will be accepted without use another Arduino. Maybe the library can detect if an interrupt is arrived and so it will not update the led strip until the next show() is called.

Turn on all led with just one argument.

This will be nice feature if you can turn on all led with just one line command.
strip.setPixelColor(n, red, green, blue);

The first argument — n in this example — is the pixel number along the strip.
So if you can add char "a" this will turn all led in strip.

Thank you

Wojciech

GPL v3 vs v2 license issue

The files Adafruit_NeoPixel.cpp and Adafruit_NeoPixel.h were initially checked in Dec 12, 2012 as stating the license was GPL 3 or later.
The file COPYING file was initially checked in Dec 12, 2012 with the text from the GPL 3 license.
These files set the license of the library to GPL v3.

Those main library files still state that the license is GPL v3; however,
in Dec 2015, the COPYING file was modified to contain the GPL 2 license.

The license in COPYING (gpl v2) is now in conflict with the specified license in the main library files and the original license of the library (gpl v3).

I'm not sure you can change from v3 back to v2, but if it is possible, it would require that every single contributor agree to this re-licensing.
If the re-licensing from v3 back to v2 is not allowed, or if all parties have not agreed to this re-licensing, then the COPYING file should be restored back to GPL v3 to match the original licensing and the specified licensing in the main library files.

numLEDs = 100 causes timing issues

During my testing when I set the number of LEDs in the Adafruit_NeoPixel strip constructor to 100, I printed millis() to the serial monitor and discovered that it almost exactly perceives 2 seconds in the real world to be 1 second in the Arduino world. After 39 minutes and 55 seconds (in the real world) of testing, the millis() function indicated that Arduino thought only 20 minutes and 0 seconds had passed.

It's perception of time also seems to change when the number of LEDs changes. When I set the number of LEDs to 10, millis() was accurate based on the few minutes of testing that I did however it's possible that it could lose a few seconds over an hour or so, but I didn't run tests for that long. Setting the number of LEDs to 30 seemed to keep pretty accurate time as well, but I will have to do more testing to verify that. When I set the number of LEDs to 1000, it kept time well, but it would not turn on any of the LEDs like it would when I set the strip length to 10, 30, and 100.

What's so strange is that this problem will not exist if I comment out the Adafruit_NeoPixel strip and use the Adafruit_WS2801 strip instead with 100 LEDs and the physical WS2801 strip. I am running tests on this library using my own programs, but if the WS2801 works, that would suggest that there is an issue with the NeoPixel library. When I used examples from this library like "strandtest" and added in something like "Serial.println(millis());" the timing issues were still there, but it may have been different from the 2:1 ratio that I discussed above.

It's certainly an interesting problem to have because explicitly setting the number of LEDs in the strip to different values appears to affect Arduino's internal clock.

Note: I did repost this from another closed issue because it seemed more appropriate to post this as its own issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.