├── EasyNeoPixels.h ├── README.md ├── examples ├── blink │ └── blink.ino └── colorSequence │ └── colorSequence.ino ├── keywords.txt └── library.properties /EasyNeoPixels.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | EasyNeoPixels.h - Library for making neopixels more approachable. 4 | Created by Evelyn Masso, April 9, 2017. 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "Arduino.h" 10 | #include 11 | 12 | Adafruit_NeoPixel easyNeoPixels; 13 | 14 | void setupEasyNeoPixels(int pin, int num) { 15 | easyNeoPixels = Adafruit_NeoPixel(num, pin, NEO_GRB + NEO_KHZ800); 16 | easyNeoPixels.begin(); 17 | } 18 | 19 | // set the nth neopixel to a particular brightness of white 20 | // meant to be used with val as HIGH or LOW 21 | void writeEasyNeoPixel(int num, int val) { 22 | easyNeoPixels.setPixelColor(num, easyNeoPixels.Color(val*255,val*255,val*255)); 23 | easyNeoPixels.show(); 24 | } 25 | 26 | // set the nth neopixel to a particular rgb color 27 | void writeEasyNeoPixel(int num, int r, int g, int b) { 28 | easyNeoPixels.setPixelColor(num, easyNeoPixels.Color(r,g,b)); 29 | easyNeoPixels.show(); 30 | } 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Easy NeoPixels Library 2 | 3 | Makes it easy to use Neopixels with just a few simple commands! 4 | 5 | No knowledge of functions, objects, or variables required. 6 | 7 | It's as easy as: 8 | 9 | ```c 10 | setupEasyNeoPixels(13, 1); // attached to pin 13, 1 neopixel long 11 | writeEasyNeoPixel(0, HIGH); // turn on the first neopixel 12 | writeEasyNeoPixel(0, 255, 0, 255); // make the first neopixel purple (red + blue) 13 | ``` 14 | 15 | ## Examples 16 | 17 | see `examples/` for a collection of arduino sketches that use this library 18 | 19 | ## A Note to Advanced Users 20 | 21 | Please be aware this library pollutes the global namespace with a variable and a few functions. 😄 22 | -------------------------------------------------------------------------------- /examples/blink/blink.ino: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Blink bright white light from a single Neopixel! 4 | 5 | */ 6 | 7 | #include 8 | 9 | void setup() { 10 | // setup for one NeoPixel attached to pin 13 11 | setupEasyNeoPixels(13, 1); 12 | } 13 | 14 | void loop() { 15 | // turn the NeoPixel ON 16 | writeEasyNeoPixel(0, HIGH); 17 | delay(500); 18 | // turn the NeoPixel OFF 19 | writeEasyNeoPixel(0, LOW); 20 | delay(500); 21 | } 22 | -------------------------------------------------------------------------------- /examples/colorSequence/colorSequence.ino: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Cycle through colors on a single Neopixel! 4 | 5 | */ 6 | 7 | #include 8 | 9 | void setup() { 10 | setupEasyNeoPixels(13, 1); 11 | } 12 | 13 | void loop() { 14 | // make it red 15 | writeEasyNeoPixel(0, 255, 0, 0); 16 | delay(500); 17 | // make it green 18 | writeEasyNeoPixel(0, 0, 255, 0); 19 | delay(500); 20 | // make it blue 21 | writeEasyNeoPixel(0, 0, 0, 255); 22 | delay(500); 23 | } 24 | -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | setupEasyNeoPixels KEYWORD2 2 | writeEasyNeoPixel KEYWORD2 3 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=Easy NeoPixels 2 | version=0.2.3 3 | author=Evelyn Masso 4 | maintainer=Evelyn Masso 5 | sentence=Use Adafruit NeoPixels with less setup and configuration. 6 | paragraph=Ideal for first-time NeoPixel users and people less comfortable with complex external libraries. 7 | category=Display 8 | url=https://github.com/outofambit/easy-neopixels 9 | architectures=* 10 | depends=Adafruit NeoPixel 11 | --------------------------------------------------------------------------------