Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

před 7 roky
před 7 roky
před 7 roky
před 7 roky
před 7 roky
před 4 roky
před 7 roky
před 7 roky
před 7 roky
před 7 roky
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 | Teensy 4.0 |
  21. | :------ | :---------: | :--------: | :--------: | :--------: | :--------: |
  22. | Serial1 | 1, 4, 5, 24 | 1, 5 | 1, 5, 26 | 1, 5, 26 | 1 |
  23. | Serial2 | | 10, 31 | 10 | 10 | 8 |
  24. | Serial3 | | 8 | 8 | 8 | 14 |
  25. | Serial4 | | | 32 | 32 | 17 |
  26. | Serial5 | | | 33 | 33 | 20, 39 |
  27. | Serial6 | | | 48 | | 24 |
  28. | Serial7 | | | | | 29 |
  29. Serial2 & Serial3 on Teensy LC are not supported, due to lack of configurable
  30. oversampling needed to run at the high speed required.
  31. Serial3-Serial6 should be used only with CPU speeds 120 or 180 MHz.
  32. Serial6 on Teensy 3.6 is not currently supported, due to different hardware
  33. registers.
  34. If more than one object instance is created, each must use a different
  35. serial port, and each must have its own buffer memory.
  36. ## 5 Volt Data Signal Level
  37. WS2812 / NeoPixel LEDs are meant to use 5 volt signals. Most of WS2812 LEDs
  38. made before 2014 or after 2015 can use 3.3V signals, which Teensy LC and 3.x
  39. output. But a buffer chip to boost the signal to 5 volts is still the best
  40. practice.
  41. Teensy LC has a 5V buffer chip built in, connected to pin 17. The best way
  42. to use this buffer is leave pin 17 unused by your program (the pin defaults
  43. to a low power disabled state), and connect the data signals from
  44. pin 24 (or any other supported pin) to pin 17. Then connect the WS2812 LEDs
  45. to the 5V signal output.
  46. ![](extras/teensylc_5v.jpg)
  47. For Teensy 3.x, a separate 5V buffer chip should be used. Unidirectional
  48. buffer chips like
  49. [74HCT245](https://www.fairchildsemi.com/datasheets/74/74VHCT245A.pdf) and
  50. [74AHCT125](https://www.adafruit.com/product/1787) are best. Do NOT use
  51. [these mosfet transistor level shifters](https://www.sparkfun.com/products/12009).
  52. They are far too slow for WS2812 LED data.