Giter Club home page Giter Club logo

sparkcore-neopixel's Introduction

SparkCore-NeoPixel

A library for manipulating NeoPixel RGB LEDs for the Spark Core and Photon. Implementation based on Adafruit's NeoPixel Library. Library currently supports WS2812, WS2812B GRB 800kHz style pixels, strips and sticks! WS2811 RGB 400kHz style pixels, strips and sticks!

Also supports these less common pixels

  • Radio Shack Tri-Color LED Strip with TM1803 controller 400kHz bitstream.
  • TM1829 pixels, many details here.

Components Required

  • A Neopixel digital RGB LED (get at adafruit.com)
  • or a Radio Shack Tri-Color LED Strip (get at radioshack.com)
  • A Particle Shield Shield or breakout board to supply neopixel's with 5V (see store at particle.io)

Example Usage

See this flashable, rainbow example for details, or, in a nutshell:

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
void setup() {
  strip.begin();
  strip.show();
}
void loop() {
  // change your pixel colors and call strip.show() again
}

Nuances

  • Make sure get the # of pixels, pin number, type of pixels correct
  • NeoPixels require 5V logic level inputs and the Spark Core and Photon only have 3.3V logic level digital outputs. Level shifting from 3.3V to 5V is necessary, the Particle Shield Shield has the TXB0108PWR 3.3V to 5V level shifter built in (but has been known to oscillate at 50MHz with wire length longer than 6"), alternatively you can wire up your own with a SN74HCT245N, or SN74HCT125N. These are rock solid.
  • Don't use getPixelColor() to move pixel data around when you are also using setBrightness(). When the brightness is set, all setPixelColor() calls will end up scaling colors to dim them before they are stored in memory. When using getPixelColor() the stored dimmed color is rescaled back up to the original color. However, due to some loss of precision with the math, it is not possible to recreate this color data perfectly. This is especially true with low brightness values. If you get and set color data repeatedly with a dimmed pixel, it will eventually continue to decrease in value until it is equal to zero.
  • When changing the brightness, always call setPixelColor() first with fresh un-dimmed color data, then call setBrightness(), and finally show().

Building locally

If you are building locally, place the files here:


../firmware/user/neo/extra-examples.cpp
../firmware/user/neo/neopixel.h
../firmware/user/neo/neopixel.cpp

Compile and program via DFU over USB with:

cd firmware/main
make clean all PLATFORM=photon APP=neo -s program-dfu

Useful Links
---

- NeoPixel Guide: https://learn.adafruit.com/adafruit-neopixel-uberguide
- Quad Level Shifter IC: [SN74ACHT125N](https://www.adafruit.com/product/1787) (Adafruit)
- Quad Level Shifter IC: [SN74HCT125N](http://www.digikey.com/product-detail/en/SN74HCT125N/296-8386-5-ND/376860) (Digikey)
- Quad Level Shifter IC: [SN74AHCT125N](http://www.digikey.com/product-detail/en/SN74AHCT125N/296-4655-5-ND/375798) (Digikey)

sparkcore-neopixel's People

Contributors

technobly avatar joegoggins avatar carldanley avatar sjunnesson avatar

Watchers

 avatar

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.