You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 7 година
пре 7 година
пре 7 година
пре 7 година
пре 7 година
пре 7 година
пре 7 година
пре 7 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # WS2812Serial - Non-Blocking WS2812B / NeoPixel LEDs Library
  2. Similar to [OctoWS2811](https://www.pjrc.com/teensy/td_libs_OctoWS2811.html), this library
  3. allows you to use WS2811, WS2812, WS2812B / NeoPixel LEDs without blocking interrupts.
  4. ![](extras/ws2812serial.jpg)
  5. Non-blocking allows other libraries, especially
  6. [Audio](https://www.pjrc.com/teensy/td_libs_Audio.html) and high speed serial communication
  7. to function properly while the LEDs update. Complex animation can also run faster,
  8. because the show() function does not wait for the LEDs to update, allowing your code
  9. more time to draw the next frame.
  10. ## Hardware Resources Used
  11. WS2812Serial controls a single LED strip, using only 1 pin. While any number of
  12. LEDs may be connected, in practice 1 pin is best for small projects with less
  13. than 600 LEDs. OctoWS2811 offers 8 parallel outputs for large projects.
  14. Non-blocking performance does come with a cost. 15 bytes of memory are required
  15. per LED, rather than the usual 3 bytes with [FastLED](http://fastled.io/) or
  16. [Adafruit NeoPixel](https://github.com/adafruit/Adafruit_NeoPixel). One of
  17. the [hardware serial ports](https://www.pjrc.com/teensy/td_uart.html) is also
  18. used to transmit the data, making that port unavailable for other uses.
  19. ## Supported Pins & Serial Ports
  20. | Port | Teensy LC | Teensy 3.2 | Teensy 3.5 | Teensy 3.6 |
  21. | :------ | :---------: | :--------: | :--------: | :--------: |
  22. | Serial1 | 1, 4, 5, 24 | 1, 5 | 1, 5, 26 | 1, 5, 26 |
  23. | Serial2 | | 10, 31 | 10 | 10 |
  24. | Serial3 | | 8, 20 | 8, 20 | 8, 20 |
  25. | Serial4 | | | 32 | 32 |
  26. | Serial5 | | | 33 | 33 |
  27. | Serial6 | | | 48 | |
  28. Serial2 & Serial3 on Teensy LC are not supported, due to lack of configurable
  29. oversampling needed to run at the high speed required.
  30. Serial6 on Teensy 3.6 is not currently supported, due to different hardware
  31. registers.
  32. If more than one object instance is created, each must use a different
  33. serial port, and each must have its own buffer memory.
  34. ## 5 Volt Data Signal Level
  35. WS2812 / NeoPixel LEDs are meant to use 5 volt signals. Most of WS2812 LEDs
  36. made before 2014 or after 2015 can use 3.3V signals, which Teensy LC and 3.x
  37. output. But a buffer chip to boost the signal to 5 volts is still the best
  38. practice.
  39. Teensy LC has a 5V buffer chip built in, connected to pin 17. The best way
  40. to use this buffer is leave pin 17 unused by your program (the pin defaults
  41. to a low power disabled state), and connect the data signals from
  42. pin 24 (or any other supported pin) to pin 17. Then connect the WS2812 LEDs
  43. to the 5V signal output.
  44. ![](extras/teensylc_5v.jpg)
  45. For Teensy 3.x, a separate 5V buffer chip should be used. Unidirectional
  46. buffer chips like
  47. [74HCT245](https://www.fairchildsemi.com/datasheets/74/74VHCT245A.pdf) and
  48. [74AHCT125](https://www.adafruit.com/product/1787) are best. Do NOT use
  49. [these mosfet transistor level shifters](https://www.sparkfun.com/products/12009).
  50. They are far too slow for WS2812 LED data.